Event handling inside gridview

Ø Grid view event handling (Controls which are inside the grid view )

1. Perform eventhandling  inside the grid view control(naming container method)

2. Naming container method in which we need to create gridviewrow object

Syntax:-

GridViewRow obj =((control)sender).naming containeer as GridViewRow 

 

GridViewRow objg1 = ((Button)sender).NamingContainer as GridViewRow

 

For creating onclick function in inside of grid control we need on click keyword

OnClick="Button5_Click"

 

 

 

 

3. We need to Use find control after the  naming container

Syntax :-

Control obj = (control)rowobject.findcontrol(controlid)

Code :-

TextBox objtxtname = (TextBox)objg1.FindControl("TextBox4");

        Response.Write(objtxtname.Text);

 

Comments

Popular posts from this blog

ViewState for state management

Database joining

INTRODUCTION OF C#