c# - Binding multiple buttons to a event handler -


i don't have experience on events & delegates. been trying found on , other sources on internet past few days.

what i'm trying custom onpagechange event our custom pagination. after (hopefully) did that, i'm told 3 more things;

1 - "onclick event" inside our control

2- making linkbuttons call onclick event

3- raising onpagechange event buttonclick of linkbuttons.

so far did these;

inside our custom pagination control (name pagingcontrol)

public class pagechangeeventargs : eventargs {     private int pagenum;      public pagechangeeventargs(int pagenum)     {         this.pagenum = pagenum;     }      public int page     {                 {             return pagenum;         }     } }  public class clickeventargs : eventargs {       public clickeventargs()     {      } }  public delegate void pagechangehandler(object sender, pagechangeeventargs e);  public delegate void pagechangeclickhandler(object sender, clickeventargs e);  //------------------------------------------------------------------------  public partial class pagingcontrol : system.web.ui.usercontrol {     //------------------------------------------------------------------------     public event pagechangehandler pagechange;     protected virtual void onpagechange(pagechangeeventargs e)     {         pagechange(this, e);     }       public event pagechangeclickhandler pagechangeclick;     protected virtual void onpagechangeclick(clickeventargs e)     {         pagechangeclick(this, e);     }          //------------------------------------------------------------------------  . . . } 

also, i'm trying let onpagechange know page sending command arguments buttons. exampe;

btnnext.text = string.format("<a href=\"{0}\"><b>{1}</b></a>&nbsp;",                 getpagingurl(convert.tostring(this.currentpageid + 1)), "<img src='../../img/next.gif' border='0' />");             btnnext.commandargument = convert.tostring(this.currentpageid + 1); 

these new , alien me, i'm lost @ how buttons , eventhandler talk.

i used page among many others things done: http://www.windowsdevcenter.com/pub/a/dotnet/2002/04/15/events.html


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -