如何从下拉列表选择中保存数据并刷新页面以供下次选择 [英] How to save the data from drop down list selection and refresh the page for next selection
问题描述
我有一个带有下拉列表的ASP.NET页面,一个文本框和带有保存按钮的是/否下拉列表。当选择此下拉列表中的每个项目时,用户应该能够在文本框中输入数据,从第二个下拉列表中选择是/否选项并保存。之后,页面应该刷新,用户应该能够为下拉列表的第二个选择输入数据(我的意思是用户应该能够输入是/否dd和文本框并保存)。稍后当用户点击保存时,页面必须导航到下一页。
目前,我有ddlists和文本框。但是,对于每个Ddlist选择,我都选择了相同的页面,其中包含数据。但是,我希望每个选择都刷新页面。
我可以选择使用Ajax asp.net。不过,请提出另一种方法。
谢谢,
Dimpy
我建议你在页面上有更多控件进行第二次选择。这意味着同样的控件再次复制到第一组控件下面。
您可以一次显示所有6个控件或者只显示一个按钮添加另一个选择,点击它将显示另一组控件。
否则,如果你想刷新,那么你需要设置第二个DropDownList
的AutoPostback
属性。在SelectedIndexChanged
事件中,您需要将当前选择保存在会话
中,并重置其他选择的控件。
I have an ASP.NET page with a drop down list, a text box and yes/no dropdown list with a save button. When each item in this dropdown list is selected the user should be able to enter data into text box, select yes/ no option from second dropdown and save this. Later, the page should get refreshed and the user should be able to enter data for the second selection of the dropdown list ( I mean the user should be able to enter yes/no dd and text box and save). Later when the user clicks on save the page has to navigate to next page.
Currently, I have the ddlists and textbox. But, for each selection of Ddlist I have the same page selected with data in it. but, I want the page to be refreshed for each selection.
I have an option to use Ajax asp.net. However, please suggest a different way to do this.
Thanks,
Dimpy
I would suggest you to have more controls on the page for the second selection. That means the same sort of controls again copied below the first set of controls.
Either you can show all the 6 controls at a time or have one button showing "Add another selection", on click of which you will show another set of controls.
Otherwise, if you want to refresh, then you need to setAutoPostback
property of the secondDropDownList
. Inside itsSelectedIndexChanged
Event, you need to save the current selection inSession
and reset the controls for another selection.
这篇关于如何从下拉列表选择中保存数据并刷新页面以供下次选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!