重定向到同一页面. [英] Redirect to same page.

查看:86
本文介绍了重定向到同一页面.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VB中有一个ASP.Net 2.0 Web应用程序.我需要从菜单操作项复制页面上显示的当前客户的所有相关数据.然后,当操作完成复制方法并使用新的唯一参考ID时,我需要使用新的唯一ID的相关数据重新加载同一页面.

例如,我有一份续约合同.我打开了合同,所有相关数据都被显示了.我从菜单项中选择了续约合同,它调用方法来复制所有原始数据并创建一个新的唯一合同ID.复制完成后,将使用新的uniqueID和新创建的数据重新加载同一页面.

我已经创建了所有复制过程,并使用菜单项将它们触发.我习惯于使用Reponse.Redirect打开另一个表单,但是如何使用新信息重新打开同一表单?

到目前为止,我想出了什么:
加载页面时引用了会话变量,其中之一是contractID.
因此,我在复制过程之后添加了代码,以获取会话变量,将其更改为新的contractID并使用新的contractID重新加载页面.

I have a ASP.Net 2.0 web app in VB. I need to copy all relavant data for the current customer shown on the page from a menu action item. Then when the action has completed the copy methods, with a new Unique reference ID, I need to reload the same page with the relavant data of the new unique ID.

For instance,I have a contract for renewal. I open the contract and all the relavant data is diplayed. I select renew contract from a menu item and it calls the mehods to copy all the original data and creates a new unique contract ID. Once the copy is complete, the same page is reloaded with the new uniqueID and newly created data.

I have created all the copy procedures and fire them with the menu item. I am used to using Reponse.Redirect to open another form, but how do you re-open the same form with new information?

What I have come up with so far:
The Page is loaded referencing the session variables, one of which is the contractID.
So I added code after the copy procedure to get the session variable, change it to the new contractID and re-load the page with the new contractID.

WebUserSession.SessionInfoGet()
Session.ContractID = NewContractID
WebUserSession.SessionInfoSet(Session)

Response.Redirect("..\frmContract.aspx")



它可以工作,但是我担心这可能不是最好的方法,因为现在,如果我想导航回原始合同,则必须将Session.ContractID更改回原始合同.



It works, but I am concerned that this might not be the best way, because now if I want to navigate back to the original contract I will have to change the Session.ContractID back to the original.

推荐答案

如果您共享代码以使情况更清晰,那就太好了.
It would be great, if you share the code for better clarity of the scenario.


是的..请让我们看看您的部分代码,以便以便我们可以验证您的问题.
Yes.. please let us see a portion of your codes so that we could verify your problem..


这是我到目前为止的内容:

This is what I have so far:

Protected Sub MenuNav_MenuItemClick 
  
 Select Case MenuNav.SelectedItem.Text

  ' Menu selection
  Case "Create Renewal" 

 
  'Method to Copy current contract data using ContractID stored in session variable and create a new contract
  CopyContract(mwus.ContractID)

    
  'Method to get newly created ContractID
  Dim ContractID as Integer
  ContractID = GetRenewalID()

  'This is what I have to show the Renewal in a different form.
  Response.Redirect("..\frmRenewal.aspx", False)

'What I need is to show the Renewal in the same form where the create renewal action originated
'Something like this:   
 'Response.Redirect("..\frmContract.aspx", ContractID)
 End Select

End Sub"


这篇关于重定向到同一页面.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆