- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- BindGrid();
- }
- }
- void BindGrid()
- {
- DataTable dt = new DataTable();
- DataRow dr = null;
-
- dt.Columns.Add(new DataColumn("slno", typeof(string)));
- dt.Columns.Add(new DataColumn("Name", typeof(string)));
- dt.Columns.Add(new DataColumn("Access", typeof(string)));
- dr = dt.NewRow();
- dr["slno"] = 1;
- dr["Name"] = "kranthi";
- dr["Access"] = string.Empty;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["slno"] = 2;
- dr["Name"] = "RAVI";
- dr["Access"] = string.Empty;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["slno"] = 3;
- dr["Name"] = "SASI";
- dr["Access"] = string.Empty;
- dt.Rows.Add(dr);
- ViewState["DT"] = dt;
- grdQues.DataSource = dt;
- grdQues.DataBind();
- }
- protected void btnshow_Click(object sender, EventArgs e)
- {
-
-
-
-
-
-
-
-
-
-
-
-
- lblmsg.Text = "Button click event!!";
- }
- protected void grdQues_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- e.Row.Attributes.Add("onmouseover", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#EEFFAA';this.style.cursor = 'pointer';");
- e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.originalstyle;this.style.cursor = 'pointer';");
- }
- }
- protected void chkAllQues_CheckedChanged(object sender, EventArgs e)
- {
- if (chkAllQues.Checked)
- {
- foreach (GridViewRow grdrowitem in grdQues.Rows)
- {
- CheckBox chkIsQues = (CheckBox)grdrowitem.FindControl("chkIsQues");
- chkIsQues.Checked = true;
- }
- }
- else
- {
- foreach (GridViewRow grdrowitem in grdQues.Rows)
- {
- CheckBox chkIsQues = (CheckBox)grdrowitem.FindControl("chkIsQues");
- chkIsQues.Checked = false;
- }
- }
- }
My problem is when i click on button or select checkbox or any other event the nested grid isdclosing automatically. i want to rise the events if the nested grid is in expand state that would be in expand state only when the button click event raise. I think the Javascript is runnig automatically on every event fired. please help