Hi
I encountered some problems when trying to do a validation check on checkbox inside a gridview.In my page there is five gridviews and all of have have checkbox inside it.
May I know how to validate the checkbox inside the five gridviews so that the user have to check at least one checkbox inside the gridview before submitting.
Your help is much appreciated.
Thank you.
Regards,
Hi:
Hope I got you correctly. Please have a look at this sample:
protected void Button1_Click(object sender, EventArgs e)
{
for (int i = 1; i < this.GridView1.Controls[0].Controls.Count - 1; i++)
Response.Write(((CheckBox)this.GridView1.Controls[0].Controls[i].FindControl("CheckBox1")).Checked + " ");
}
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField></Columns>
</asp:GridView>
If it's not really what you want, please inform us.
Regards.
Hi! Thank for your reply.I have resolved the problems although the reply is not really what I want.
Your reply is much appreciated.Thank you.:-)
No comments:
Post a Comment