Click here to Skip to main content
15,896,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Code
XML
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id"
                    DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True">
                    <Columns>
                        <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id" />
                        <asp:BoundField DataField="Question" HeaderText="Question" SortExpression="Question" />
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:RadioButtonList AutoPostBack="true" ID="rbl" runat="server" Enabled="true" SelectedIndex='<%#Convert.ToInt32(DataBinder.Eval(Container.DataItem , "Discontinued"))%>'
                                    OnSelectedIndexChanged="rbl_SelectedIndexChanged">
                                    <asp:ListItem Value="0">No</asp:ListItem>
                                    <asp:ListItem Value="1">Yes</asp:ListItem>
                                </asp:RadioButtonList>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>

XML
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:studentConnectionString %>"

                    SelectCommand="SELECT * FROM [AddQustSrvs] where [Category]='Food' and [UserId]= @userId "
                    UpdateCommand="UPDATE [AddQustSrvs] SET [Discontinued] = @Discontinued WHERE [id] = @id">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="'<%= userid %>'" Name="userId" DbType="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Discontinued" Type="Boolean" />
                        <asp:Parameter Name="id" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>


passing Value '<%=userid%>'


userid = Session["kill"].ToString(); code behind
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900