| | |
raise event handler for image button
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jan 2009
Posts: 3
Reputation:
Solved Threads: 0
I have created image button at run time. But I want to know when I will click on this button then its click function will get call.How to create click event of this image button.
I have tried
But it is working only when bindgrid function calls on every post back.otherwise not if bindgrid function is put under (!page.postback)
I have tried
ASP.NET Syntax (Toggle Plain Text)
Function bindgrid() { Buttonname.click+-new ImageClickEventHandler(Buttonname_click); } Protected void Buttonname_click(object sender, ImageClickEventArgs e) { }
But it is working only when bindgrid function calls on every post back.otherwise not if bindgrid function is put under (!page.postback)
Last edited by peter_budo; Jan 21st, 2009 at 7:51 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Dec 2008
Posts: 104
Reputation:
Solved Threads: 18
On page load do this
Your click function should be like this
protected void dynImageButton_Click(object sender, EventArgs e)
{
Response.Write("Inside Image Button Click");
}
ASP.NET Syntax (Toggle Plain Text)
//Creating Dynamic Image Button ImageButton objImageButton = new ImageButton(); objImageButton.ID="dynImageButton"; objImageButton.ImageUrl="Your Image URL"; //Add Click event handler objImageButton.Click += new System.Web.UI.ImageClickEventHandler(dynImageButton_Click); form1.Controls.Add(objImageButton);
Your click function should be like this
protected void dynImageButton_Click(object sender, EventArgs e)
{
Response.Write("Inside Image Button Click");
}
•
•
Join Date: Jan 2009
Posts: 3
Reputation:
Solved Threads: 0
but the problem is this function is not getting called if I am writing in Pageload the whole thing inside
Please tell me the solution of this..
ASP.NET Syntax (Toggle Plain Text)
]if(1Page.IspostBack) {//Creating Dynamic Image Button ImageButton objImageButton = new ImageButton(); objImageButton.ID="dynImageButton"; objImageButton.ImageUrl="Your Image URL"; //Add Click event handler objImageButton.Click += new System.Web.UI.ImageClickEventHandler(dynImageButton_Click); form1.Controls.Add(objImageButton); //Creating Dynamic Image Button ImageButton objImageButton = new ImageButton(); objImageButton.ID="dynImageButton"; objImageButton.ImageUrl="Your Image URL"; //Add Click event handler objImageButton.Click += new System.Web.UI.ImageClickEventHandler(dynImageButton_Click); form1.Controls.Add(objImageButton); } protected void dynImageButton_Click(object sender, EventArgs e) { Response.Write("Inside Image Button Click"); }
Please tell me the solution of this..
Last edited by peter_budo; Jan 21st, 2009 at 7:52 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Mar 2009
Posts: 2
Reputation:
Solved Threads: 0
hi khushi2$...
i have same problem with u...
n i have posting in many forum n no one can resolve it... OMG...
the problem is just simple as you say...
i create imagebutton n it's click event...
but when i click the imagebutton, the event not getting called...
my code is :
when i click imagebutton, it won't show the messagebox....
maybe you can try using button... my friend tell me that she use button with the same method and work...
i have same problem with u...
n i have posting in many forum n no one can resolve it... OMG...
the problem is just simple as you say...
i create imagebutton n it's click event...
but when i click the imagebutton, the event not getting called...
my code is :
ASP.NET Syntax (Toggle Plain Text)
Protected Sub Gerak(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) MsgBox("Masuk", MsgBoxStyle.OkOnly) End Sub For i = 0 To jum - 1 img(i) = New ImageButton() AddHandler img(i).Click, AddressOf Me.Gerak img(i).ImageUrl() = "images/kodok-hijau.gif" pGame.Controls.Add(img(i)) Next
when i click imagebutton, it won't show the messagebox....
maybe you can try using button... my friend tell me that she use button with the same method and work...
Last edited by peter_budo; Mar 27th, 2009 at 3:35 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: ImageButton Command Event
- Next Thread: Login Page
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox class compatible confirmationcodegeneration content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv forms gridview gudi homeedition iis javascript jquery list listbox menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming wizard xml xsl





