Click to See Complete Forum and Search --> : ASP.NET : GridView, SqlDataSource and @*_original parameters


darwen
December 9th, 2008, 06:47 PM
I've tried everything I can think of to get this to work so I am wondering if someone could help.

According to the docs the update command statement when called via the 'edit/update' on the GridView is supposed to contain @original_ parameters for the existing values rather than the new ones.

However this just isn't working. Examining the command in the update event of the data source shows they aren't there.

Am I missing something ? I've read every piece of documentation I can think of.


<asp:SqlDataSource
ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:default %>"
SelectCommand="select Name, Version, dbo.GetMoneyAsString(A.PricePerUnit, 2) as [PricePerUnit] from dbo.vw_AllFileInformation as A order by Name, Version"
UpdateCommand="update dbo.vw_AllFileInformation set Name = @Name, Version = @Version, PricePerUnit = @PricePerUnit where Name=@original_Name and Version=@original_Version"
DeleteCommand="delete from dbo.vw_AllFileInformation where Name = @original_Name and Version=@original_Version"
DataSourceMode="DataSet" >
</asp:SqlDataSource>
<asp:GridView
ID="AllFilesGridView" runat="server" style="width:100%"
CellPadding="4" DataSourceID="SqlDataSource1" Font-Size="Small"
ForeColor="Teal" GridLines="None" AutoGenerateDeleteButton="True"
AutoGenerateEditButton="True" AutoGenerateColumns="false" DataKeyNames="Name,Version"
EnableViewState="True">
<RowStyle BackColor="#009090" ForeColor="White" />
<FooterStyle BackColor="#008080" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#008080" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008080" Font-Bold="True" ForeColor="Black" />
<HeaderStyle BackColor="#006060" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#008080" />
<AlternatingRowStyle BackColor="#00a0a0" ForeColor="White" />
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Version" HeaderText="Version" />
<asp:BoundField DataField="PricePerUnit" HeaderText="Price Per Unit" />
</Columns>
</asp:GridView>


Thanks

Darwen.

darwen
December 9th, 2008, 06:52 PM
Oops - sorry, wrong forum. Can an admin move this to the ASP.NET forum please ?

Thanks,

Darwen.