Link to home
Start Free TrialLog in
Avatar of Rad1
Rad1

asked on

How to call ASP.NET event from another event

Hello,

How can I call "GridView1_SelectedIndexChanging(object sender, System.Web.UI.WebControls.GridViewSelectEventArgs e)" from
"protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)"

Thank you!!!
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

why would you want to do that?

Just write the code you want into a private method and call that method.

Won't this work for you?
Avatar of Rad1
Rad1

ASKER

Can you please elaborate with example?

Thank you!
ASKER CERTIFIED SOLUTION
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rad1

ASKER

How can I call this code from
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)


int i = 0;
            foreach (GridViewRow gr in GridView1.Rows)
            {
                CheckBox cb = (CheckBox)gr.Cells[1].FindControl("ChkBx1");
                if (cb.Checked == false)
                {

                    if (!IsPostBack)
                    {
                        GridView1.Columns[i].Visible = false;
                    }
                }
            }

Open in new window

Avatar of Rad1

ASKER

Thank you!!!