0

I have a UserControl which contain gridview.I register this usercontrol to a page aspx normal.But it set str_btn alway null when I press select at GridView.

if(!Page.IsPostBack)
{

}
else
{
  string str_btn = null;
  if (Request.Form.Keys[Request.Form.Keys.Count - 1]!=null)
       str_btn=Request.Form.Keys[Request.Form.Keys.Count - 1].ToString();
  if(!string.IsNullOrEmpty(str_btn))
       handleClick(str_btn);
}

How to I get Gridview event in usercontrol from aspx page?

Thank for any help.

MethodMan
  • 18,625
  • 6
  • 34
  • 52
Brian
  • 163
  • 2
  • 18
  • Where is the User Control in your code..? how are you loading / Registering the user control.. ? can you please show relevant code that relates to your issue...? – MethodMan Jan 08 '13 at 03:20
  • Thanks for your support,brother.I have 2 link for explain this issues in detail. http://stackoverflow.com/questions/14189851/cant-access-gridview-event-at-usercontrol-by-codebehind/14190246#comment19673274_14190246 – Brian Jan 08 '13 at 03:25
  • http://stackoverflow.com/questions/14150848/get-gridview-in-multiple-usercontrol-from-codebehind/14150889#comment19599867_14150889 – Brian Jan 08 '13 at 03:25
  • Two link is relate with this issues.In Fisrt link,I resolved it.I've been working on second link.Second link is same this topic.Thanks – Brian Jan 08 '13 at 03:28

1 Answers1

1

Just simply select your "Gridview" in design mode and open it's properties.

Now just Click on the event icon given in following image:

enter image description here

After that Whatever Events you just want to generate on that you just have to double click. For eg. Here "RowDeleting" and other events are already generated.

Now, if you want to generate event for "Rowdeleted" just double click right side of that "Rowdeleted".

enter image description here

This all are events, and it's related code will be available in .cs file.

If you want to know more just follow this link GridView Events