|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Get argument with imageclickeventhandler.Hi. Anyone know how to get argument from imageclickeventhandler?
ImageButton myimage = new ImageButton(); myimage.ID = "myimageid"; myimage.Click += ImageClickEventHandler(clicked); void clicked(object sender, imageclickeventargs e){ //get myimage.ID here? } Hi there cykill,
This one is quite simple... If you debug this and have a look at the "sender" object you'll easilly figure out that it is your ImageButton... Now all you have to do is recast it to it's own type and get the ID. so... let's look at the code then... ///////////////////////////////////////////////////////////////////// string myImageButtonId; ImageButton myImageButton = (ImageButton)sender; myImageButtonId = myImageButton.ID; //or even simpler... myImageButtonId = ((ImageButton)sender).ID; ///////////////////////////////////////////////////////////////////// Hope this helped... Show quoteHide quote "cykill" wrote: > Hi. Anyone know how to get argument from imageclickeventhandler? > > ImageButton myimage = new ImageButton(); > myimage.ID = "myimageid"; > myimage.Click += ImageClickEventHandler(clicked); > > void clicked(object sender, imageclickeventargs e){ > //get myimage.ID here? > } >
CustomValidator
DropDownList Input Control disappears Alternative to asp:MenuControl? Upload Excel Spreadsheet GridView Edit Template Control Style Page Panels How to prevent JavaScript conflict in custom server control (when added more than once to a page) Control disappears Enter key as select/submit button |
|||||||||||||||||||||||