带回发的ImageButton [英] ImageButton with Postback
问题描述
你好
是否可以在ASP.NET上为ImageButton进行回发
我想要的是当用户没有点击我的图像按钮时,什么都不会发生。
编辑
OK为了进一步解释,我有一个ASP页面,它有2个Imagebutton,每个按钮都有一个用户控件查询数据库。
ImageButton1 - >查询分支
ImageButton2 - >查询分支机构的员工
每次单击ImageButton2,搜索分支机构的员工并选择它,我想知道为什么它进入ImageButton1。所以,我打算在ImageButton1上使用isPostBack条件,这样它就不会触及ImageButton1的过程
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
推荐答案
检查这些条件
- -----------------------
条件1:
Check these conditions
-------------------------
Condition 1 :
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* //
}
条件2 :
您需要检查两个图像按钮的OnClick事件,有时您可能为两个按钮提供相同的事件
Condition 2 :
You need to check the OnClick Event of two Image Buttons, Some time You may provided the same event for two buttons
这篇关于带回发的ImageButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!