Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi bungpeng

thx for replying

what i need to do is this

say i'm currently in a page called A.aspx in a href i'm calling a page called B.aspx

after doing some code there (in page B) i need to go back to the

page A.aspx

and i want the the data which exist earlier in the page A

i cannot use redirect fo rhtis cos page A contain query strings

Posted

that is exactly what i want

but i cannot use javascript

is there a method to do this in C#

if so pls let me know

thx

Posted

You cannot use javascript? why?

Because C# is server site language and javascript is client site language, you cannot do this using server site language.

 

The advantage of javascript is it support by all type of browsers & it is free. I don't know why can't you use it...

Posted

Try a parameter with the return URL

 

I use the following code to update my main page when i update data in a popup-window:

 

Open the popup-window wiht a parameter:

....FilterPage.aspx?BaseURL="contact_tab.aspx&ID=xyz"....

 

Take care you have to replace the "&"

 

In the popUp:

...

sRet = Request.QueryString("baseURL")

....

 

To close the PopUp and reload to the original page:

(You can also define a link so that you don't have to do a postback)

....

RegisterClientScriptBlock("JS_Go", JavaScript.closePopUp(sret))

 

JavaScript.closePopUp is defined by me, because i don't like JavaScript (especially in my code) ;)

 

Here's the definition:

 

Const START_JS_TAG = "<script language='JavaScript'>"

Const END_JS_TAG = "</script>"

Const START_JS_LINK = "javaScript:"

Const END_JS_LINK = ""

 

Public Function closePopUp(Optional ByVal sBaseURL As String = Nothing, Optional ByVal AsLink As Boolean = False) As String

Dim tmpString As String

 

tmpString = IIf(AsLink, START_JS_LINK, START_JS_TAG)

If Not IsNothing(sBaseURL) Then

'Seite neu aufrufen

tmpString += "window.opener.location.href='" & sBaseURL & "';"

End If

tmpString += "window.close();"

tmpString += IIf(AsLink, END_JS_LINK, END_JS_TAG)

 

Return tmpString

End Function

Posted

yes it is

 

Yes!

 

The gist is:

 

Save the URL (querystring) somewhere you like it and where you can access it from "B" page.

 

In the "B" page you can read your URL (querystring) and do a

Server.transfer or whatever you want.

 

What i do: I'm saving the querysting into a querystring.

Sure, you can do it much easier.

Posted

You could also save Page A's info in the Session Object, although if the number of data items is large, it could be a mess. You CAN create a class/DLL in C# and assign that class to the Session object. Check out this thread:

 

http://www.xtremedotnettalk.com/showthread.php?s=&threadid=81560

 

Then, you can just use Response.Redirect("PageA.aspx") to navigate without querystrings.

 

Basically, it would depend on the number of data items.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...