Click here to Skip to main content
15,914,447 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

Is it possible to make a Postback for a ImageButton on ASP.NET

What I want is when User didn't click my Image button nothing will happen.

EDIT
OK to explain it further, I have a ASP page which have 2 Imagebutton each button had a user control which query on the database.

ImageButton1 -> Query the Branches
ImageButton2 -> Query the Employee of the branch

Every time I Click ImageButton2, search the Employee of the Branch and Select it, I was wondering why It enters on ImageButton1. So, Am planning to use isPostBack condition on ImageButton1 so that it will not touch the process of ImageButton1
Posted
Updated 18-Sep-13 21:25pm
v3
Comments
Salman622 19-Sep-13 2:43am    
what you want to do......?
VICK 19-Sep-13 3:08am    
Seems like illogical question...

Well do you want to do postback through your image button or what???

Explain it to get proper help...
If you click on ImageButton2, then it should not go to ImageButton1 Event.
Please post the code. We need to look at it.

1 solution

Check these conditions
-------------------------
Condition 1 :
C#
 protected void Page_Load(object sender, EventArgs e)
{

if(!IsPostBack)
{
// *Set the Initial Loading conditions, Call the Function that needs to be called on first Page Load* //
FirstLoad();

// *If you failed to add this Condition, Page Will load the FirstLoad() each time round trip Occures* //
}


}
Private void FirstLoad(){

// *First Load* //
}

protected void ImgButton1_Click(object sender,EventArgs e)
{
// *Button Click Event* //
}

protected void ImgButton2_Click(object sender,EventArgs e)
{
// *Button Click Event* //
}


Condition 2 :
You need to check the OnClick Event of two Image Buttons, Some time You may provided the same event for two buttons
 
Share this answer
 
Comments
iMaker.ph 19-Sep-13 22:36pm    
What should I put on FirstLoad?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900