i have few survey question in my gridview,user can select one selection only for each question.I have difficulty in getting user selection in c#,please guide me on this thanks.. i want to have output something like this after i click submit button:
1. checkP
2. checkG
3. checkG
4. checkG
5. checkP
protected void Page_Load(object sender, EventArgs e)
{
DataTable question_x = new DataTable("Question");
question_x.Columns.Add(new DataColumn("ID", System.Type.GetType("System.UInt64")));
question_x.Columns.Add(new DataColumn("Name"));
question_x.Rows.Add(1, "1) Training deliver can be understood?");
question_x.Rows.Add(1, "2) The way instructor deliver the training is satisfaction?");
question_x.Rows.Add(1, "3) The notes are easy to understand?");
question_x.Rows.Add(1, "4) The training room is appropriate?");
question_x.Rows.Add(1, "5) The training time is satisfactory?");
gvEdit.DataSource = question_x;
gvEdit.DataBind();
}
<asp:GridView runat="server" CssClass="table table-striped table-bordered table-hover" ID="gvEdit" DataKeyNames="ID" AutoGenerateColumns="false" HeaderStyle-BackColor="CornflowerBlue" HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="White" CellPadding="5">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Question" ItemStyle-ForeColor="White" ItemStyle-HorizontalAlign="Left" ItemStyle-BackColor="graytext" />
<asp:TemplateField HeaderText="Poor">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:RadioButton runat="server" ID="chkP" onclick="javascript:GridSelectAllColumn(this, 'chkPoor');" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Good">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:RadioButton runat="server" ID="chkG" onclick="javascript:GridSelectAllColumn(this, 'chkGood');" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Aucun commentaire:
Enregistrer un commentaire