asp.net按钮问题
protected void Button1_Click(object sender, EventArgs e){
if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "" || RadioButtonList1.SelectedIndex == -1)
{
Label1.Text = "还有选项未填满";
}
else
{
Label1.Text = "";
}
}
为何点击按钮 原来的网页会被刷掉,该如何解决? --------------------编程问答-------------------- 因为这个按钮不是一般的按钮
他是服务器按钮!
你看rant=server
换HTML 的INPUT 试下。 --------------------编程问答-------------------- 你的按鈕是 asp:button吧?
換成Input type = "button" --------------------编程问答-------------------- 他是服务器端按钮,点击它会触发一个页面周期,页面当然会刷新了 --------------------编程问答-------------------- 用<Input type = "button" />
如果想把事件写在后台,可以用ajax的无刷新去做 --------------------编程问答-------------------- 如果实在要用服务器按钮控件,需要把你在page_load中的事件在按钮事件中再绑一次。
补充:.NET技术 , ASP.NET