如何在单击按钮单击事件中创建序列 [英] how to make a sequence in click in button click event
本文介绍了如何在单击按钮单击事件中创建序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网页表单,有三个按钮,如按钮1,按钮2,按钮3,
i希望用户无法从按钮1跳到按钮3,他必须按照序列。喜欢
i have a web form ,there are three buttons, like button 1 ,button 2 ,button 3,
i want that user cant make a jump from button 1 to button 3,he must follow the sequence. like
after entering date into the textbox user must follow these steps
protected void Button1_Click(object sender, EventArgs e)
{
code
}
then
protected void Button2_Click(object sender, EventArgs e)
{
code
}
protected void Button1_Click(object sender, EventArgs e)
{
code
}
推荐答案
这是我们努力保持的东西远离:它强迫用户按照现代用户非常极少的顺序工作。
为网络执行此操作的正常方法形式会b e有多个页面,因此第一个按钮创建一个具有第二个按钮的新显示,依此类推。想想你真正需要的方式 - 在购物网站上首次购买:
第一页:电子邮件和密码
第二页:地址确认/输入
第三页:付款细节
第四页:承诺购买。
每页都有一个后退按钮。
你不是在一个页面上这样做(因为它令人困惑)所以为什么你的任务会有所不同?应用程序控制用户处理页面的顺序的程序输入现在非常非常罕见。
That's something we try very hard to stay away from: it "forces" the user to work in a sequence which very, very few modern users do these days.
The normal way to do this for a web form would be to have multiple "pages" so the first button create a new display that has the second button, and so on. Think of the way you do this when you really have to - a first purchase on a shopping site:
Page one: email and password
Page two: address confirmation / entry
Page three: payment details
Page four: commit to buy.
And each page has a "back" button.
You don't do this on a single page (because it's confusing) so why would your task be any different? Procedural inputs where the app controlled the order in which the user handled a page are very, very rare these days.
您可以在网页中使用Mulltiview控件,其中您可以拥有3个视图和每个视图都有一个按钮。点击按钮,它将切换到下一个视图。作为参考,您可以参考下面的多视图示例。
http://www.tutorialspoint.com/asp.net/asp.net_multi_views.htm [ ^ ]
You can use Mulltiview control in your webpage, Where you can have 3 Views and each view will have a button. On click of button it will switch to next view. For reference you can refer below multi view example.
http://www.tutorialspoint.com/asp.net/asp.net_multi_views.htm[^]
i have used following solution
on Page_Load set
button2.visible = false;
button3.visible = false
and when function of button1 is completed then it call
button2.visible = true;
same as above and when function of button2 is completed then it call
button3.visible = true;
这篇关于如何在单击按钮单击事件中创建序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文