简体   繁体   English

刷新上一页下拉选择

[英]Refresh previous page dropdown selection

I'm quite new to C# and asp.net and have been struggling for a few days to sort out what seems to be something simple.我对 C# 和 asp.net 很陌生,并且已经努力了几天来整理出似乎很简单的东西。 I've got two pages lets call it page1.aspx and page2.aspx我有两个页面让我们称之为 page1.aspx 和 page2.aspx


page1.aspx页面1.aspx

I've got two dropdownlists with a continue button.我有两个带有继续按钮的下拉列表。 Once the continue button is clicked it will populate data specified in my sql statement.单击继续按钮后,它将填充我的 sql 语句中指定的数据。 On the first column I've got a hyperlink 'view' and in the last column I've got checkboxes which are disabled.在第一列我有一个超链接“视图”,在最后一列我有禁用的复选框。 Once I click on the view hyperlink it takes me to page2.aspx which has a button Tick and Untick which ticks the checkbox on page1.aspx单击视图超链接后,它会将我带到 page2.aspx,其中有一个“勾选”和“取消勾选”按钮,可勾选 page1.aspx 上的复选框


page2.aspx页面2.aspx

On this page I've got three buttons (back, tick, untick) the tick and untick buttons is just to tick or untick the disabled checkboxes on page1.aspx.在这个页面上,我有三个按钮(返回、勾选、取消勾选),勾选和取消勾选按钮只是勾选或取消勾选 page1.aspx 上禁用的复选框。 On the back button I'm trying a response.redirect('page1.aspx');在后退按钮上,我正在尝试 response.redirect('page1.aspx'); however when I get redirected the dropdownlist is empty and it doesnt repopulate the previous selected criteria to show the newly ticked or unticked checkbox.但是,当我被重定向时,下拉列表是空的,它不会重新填充以前选择的条件以显示新勾选或未勾选的复选框。


What I've tried我试过的

  1. I tried a function我尝试了一个功能
    function fnHistory() {
        window.history.go(-1);
    }

on the back button of page2.aspx this does keep my dropdownlist values on page1.aspx however it doesnt display the newly ticked checkbox since the page needs to be refreshed and refreshing the page takes away the dropdown values.在 page2.aspx 的后退按钮上,这确实将我的下拉列表值保留在 page1.aspx 上,但是它不会显示新勾选的复选框,因为页面需要刷新,刷新页面会带走下拉值。

  1. I tried to do a page refresh every 5 seconds on the div where the sql data gets displayed this is however not a option as its just bad practice.我试图在显示 sql 数据的 div 上每 5 秒刷新一次页面,但这不是一个选项,因为它只是不好的做法。

  2. I've tried update panel on page 1 for the div where the sql data gets displayed however the trigger which should be the tick and untick button is on page2.aspx我已经尝试在第 1 页上为显示 sql 数据的 div 更新面板,但是应该是勾选和取消勾选按钮的触发器位于 page2.aspx

Your help and advice will be highly appreciated.您的帮助和建议将不胜感激。

Is there anything unique on page2 that you have to open it in another window? page2 上有什么独特的东西需要在另一个窗口中打开吗? What about opening the 2nd page in a modal?在模态中打开第二页怎么样? So you can get access to page1 directly.所以你可以直接访问page1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM