B
beaudetious
Can an eagle eye help me fix whatever is causing me pain here? When I click
the update command button, the page refreshes but the new values do not make
it to the database or back into the gridview.
I'm getting the dreaded "Must declare the variable @original_RoleId"
exception message. My source code looks like this:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="RoleID" DataSourceID="SqlDataSource1"
OnRowDataBound="GridView1_RowDataBound"
OnRowUpdating="GridView1_RowUpdating">
<Columns>
<asp:BoundField DataField="RoleName" HeaderText="RoleName"
SortExpression="RoleName" />
<asp:BoundField DataField="Description" HeaderText="Description"
SortExpression="Description" />
<asp:TemplateField HeaderText="Users In Role">
<ItemTemplate>
<asp:Label ID="lblUserCount" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:AAWSqlConnectionString %>"
SelectCommand="SELECT RoleId, RoleName, LoweredRoleName, Description FROM
aspnet_Roles"
UpdateCommand="UPDATE aspnet_Roles SET [RoleName]=@RoleName,
[Description]=@Description WHERE RoleId = @original_RoleID">
</asp:SqlDataSource>
Any suggestions here?
beaudetious
the update command button, the page refreshes but the new values do not make
it to the database or back into the gridview.
I'm getting the dreaded "Must declare the variable @original_RoleId"
exception message. My source code looks like this:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="RoleID" DataSourceID="SqlDataSource1"
OnRowDataBound="GridView1_RowDataBound"
OnRowUpdating="GridView1_RowUpdating">
<Columns>
<asp:BoundField DataField="RoleName" HeaderText="RoleName"
SortExpression="RoleName" />
<asp:BoundField DataField="Description" HeaderText="Description"
SortExpression="Description" />
<asp:TemplateField HeaderText="Users In Role">
<ItemTemplate>
<asp:Label ID="lblUserCount" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:AAWSqlConnectionString %>"
SelectCommand="SELECT RoleId, RoleName, LoweredRoleName, Description FROM
aspnet_Roles"
UpdateCommand="UPDATE aspnet_Roles SET [RoleName]=@RoleName,
[Description]=@Description WHERE RoleId = @original_RoleID">
</asp:SqlDataSource>
Any suggestions here?
beaudetious