Hi,
You need to follow two steps.
1.On Ok_Button_Click Event Store the Checkbox Values in session.
Session["Checkbox1"]= Checkbox1.Checked
2. In Page Load ( When PopUp opens) you need need to retrieve values back If it is already checked from the session.
If(!Page.IsPostback){
if(Session["Checkbox1"]!=null)
{
Checkbox1.Checked=bool.Parse( Session["Checkbox1"].ToString());
}
}
hope it helps
In that Case You can save the value of checkboxes in Session on Ok Click and retrieve them from Session on PageLoad
here is the example code.
on Button Click
bool[] values = new bool[GridView1.Rows.Count];
CheckBox chb;
int count = 0;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
chb = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");
if (chb != null)
{
values[i] = chb.Checked;
}
}
Session["GridValues"] = values;
on Page Load
if (Session["GridValues" ] !=null)
{
CheckBox chb;
bool[] values = (bool[])Session["GridValues"];
for (int i = 0; i < GridView1.Rows.Count; i++)
{
chb = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");
chb.Checked = values[i];
}
}
Let me know if it works for you.
Thanks