J
Jon Paal
when updating from a gridview, the value selected from a dropdownlist is applied to the field for all records in the table instead
of just the selected record. How can I fix this ?
....asp:SqlDataSource
UpdateCommand="UPDATE UserData SET status = @status WHERE userid = @userid ">
<UpdateParameters>
<asparameter Name="userid " Type="String" />
</UpdateParameters>
....asp:GridView
DataKeyNames="userid"
....
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:Label id="label1" runat="server" Text='<%# Eval("Status") %>' />
</ItemTemplate>
<EditItemTemplate>
<aspropDownList runat="server" ID="ddlStatus"
AppendDataBoundItems="true"
SelectedValue='<%# Bind("status") %>'
DataSourceID= "SqlDataSource1"
AutoPostBack="False" >
<asp:ListItem Text="Open" Value="Open"></asp:ListItem>
<asp:ListItem Text="Closed" Value="Closed"></asp:ListItem>
</aspropDownList>
</EditItemTemplate>
</asp:TemplateField>
of just the selected record. How can I fix this ?
....asp:SqlDataSource
UpdateCommand="UPDATE UserData SET status = @status WHERE userid = @userid ">
<UpdateParameters>
<asparameter Name="userid " Type="String" />
</UpdateParameters>
....asp:GridView
DataKeyNames="userid"
....
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:Label id="label1" runat="server" Text='<%# Eval("Status") %>' />
</ItemTemplate>
<EditItemTemplate>
<aspropDownList runat="server" ID="ddlStatus"
AppendDataBoundItems="true"
SelectedValue='<%# Bind("status") %>'
DataSourceID= "SqlDataSource1"
AutoPostBack="False" >
<asp:ListItem Text="Open" Value="Open"></asp:ListItem>
<asp:ListItem Text="Closed" Value="Closed"></asp:ListItem>
</aspropDownList>
</EditItemTemplate>
</asp:TemplateField>