Hi,
I am using check box in ItemTemplate(gridview) in User Control. I wrote some code in CheckedChanged event. It is Running. after completing the event my page is loading with uncheck checkbox.
<asp:TemplateField ItemStyle-Width="4%">
<ItemTemplate>
<asp:CheckBox Width="10%" ID="chkDocumentName" runat="server" onClick="GetGridViewSelectedRow();" OnCheckedChanged="chkDocumentName_CheckedChanged" AutoPostBack="true"/>
</ItemTemplate>
<ItemStyle Width="3%" />
</asp:TemplateField>
protected void chkDocumentName_CheckedChanged(object sender, EventArgs e)
{
for (int i = 0; i < gvDocumentTemplatestatus.Rows.Count; i++)
{
CheckBox chkbox = (CheckBox)gvDocumentTemplatestatus.Rows[i].FindControl("chkDocumentName");
if (chkbox.Checked == true)
{
Label lblTemplateId = (Label)gvDocumentTemplatestatus.Rows[i].FindControl("lblTempID");
Label lblDocumentNumberID = (Label)gvDocumentTemplatestatus.Rows[i].FindControl("lblDocumentNumberID");
Label lblTemplateName = (Label)gvDocumentTemplatestatus.Rows[i].FindControl("lblTemplateName");
Session["rownumber"] = i.ToString();
Session["TempID"] = lblTemplateId.Text;
}
else
{
if (Session["rownumber"] != null)
{
if (Convert.ToInt32(Session["rownumber"].ToString()) == i)
{
strcolumnnumber = "0";
Session["SubJobID"] = strcolumnnumber;
}
}
}
}
}
This is my code after postback my check box is unchecked.
if any one know about this tell me.
Regards
Nanda Kishore.CH .