pass parameter captured from 1st page to the 2nd and then to the third page.

Hi, I have 3 web pages involved. I am trying to pass parameters from first page to the second. First page has a link that redirects users to the second page and passes an ID. On the second page I have a button that will take those parameters captured from the first page and redirect users to the third page with those parameters. I am unable to capture the parameters and pass it on to the third page from the second page. I keep getting syntax errors while combining javascript and C#. Here is what I have tried so far:

1. Stored the parameters from in incoming URL in a variable called param1 in the page load event on the second page. This statement in a button click event on the second page gives me an error that paramters don’t exist in the current context.

ClientScript.RegisterClientScriptBlock(this.GetType(), "open", "window.open(String.Format('http://myURL{0}', "+param1+"));window.close();", true);

2. Tried to get a handle directly by using the Request.URL.Query in the button click event of the second page with this code also but it gave me an error undetermined string constant

ClientScript.RegisterClientScriptBlock(this.GetType(), "open", "window.open(String.Format('http://muURL{0}, Request.Url.Query));window.close();", true);

 

Thanks

0
armanz1
5/4/2009 9:09:09 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

2 Replies
1371 Views

Similar Articles

[PageSpeed] 53

Have you considered using the session?  That way it is easily accessible by all pages.  So on page1 you could define one session object when the user submits the form after they fill in their given name:

private void btnSubmit_Click(object sender, EventArgs e)
{
    Session["GivenName"] = txtGivenName.Text;
} 
Then on page2 and page3 if they want to reference that object they need to do the following: 
if(Session["GivenName"] != null)
{
    txtGivenName.Text = Session["GivenName"].ToString();
}
  
 

Sincerely,
Malcolm Sheridan
Microsoft Certified Solution Developer
Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as
Answer" if a marked post does not actually answer your question.
0
malcolms
5/5/2009 12:32:59 AM
ClientScript.RegisterClientScriptBlock(this.GetType(), "open", "window.open(String.Format('http://myURL{0}', "+param1+"));window.close();", true); 

for this, can you do a debug whether param1 storing any value? or when page postback did you reassign the query string value back to the param1?

0
mo
5/5/2009 2:07:20 AM
Reply:

Similar Artilces:

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: http://msdn2.microsoft.com/en-us/library/ms178139.aspxAlso: http://msdn2.microsoft.com/en-us/library/ms178140.aspx might ...

Transfer Gridview DataKeys 1st page to a 2nd page but loosing values on 2nd page postback?
hey out there, this is driving me nuts! i'm trying to transfer a number of 'DataKeys' from one page to a second page. i can get the values to come across using 'Server.Transfer' but when a button on the receiving page is clicked (causing a postback), the url changes and i lose the values. how do i keep them?! it's a simple 'post page ones values to page two, perform a search on page two by clicking a button, select an option and go back to the 1st page' kinda thing. on my initial page i've a gridview:1 <asp:GridView ID="GridView1" runat=...

How to pass the form contents of aspx page in .Net to Jsp page
Hi,   I want to pass the login information from aspx page to jsp page. plz help me how to do it. Please reply asap. Thanks...

Paging Paging Paging
I am trying to do paging with my search results and it isnt working very well. Here is what I've tried and I feel I've tried everything, lol, please help me out. Sub DataGrid1_SortCommand(Sender as object, e as DataGridSortCOmmandEventArgs) DataGrid1.DataBind() End Sub Sub Datagrid1_PageIndexChanged(Sender as object, e as DataGridPageChangedEventArgs) Dim ds as dataSet DataGrid1.CurrentPageIndex = e.NewPageIndex if Session("Search") is nothing then 'Session probably has expired, get the datasource from database Datagrid1.DataSource = ...

how to open a web page in form of a popup web page
Hello, I have two web pages, let say. Page A : With a Button on it. PAge B: with some info. Now I need to: When I click on the Button of page A.Page B must open in a pop up window.  I can do this but problem is this when I clicked on the button for first time it does not show me any thing and when I clicked on the button for second time then It shows me Page B .My code is as follow:  1 protected void Page_Load(object sender, EventArgs e) 2 { 3 if (!this.Page.IsPostBack) 4 { 5 6 } 7 else 8...

Multiple Page Web-forms, without passing earlier pages values to the next one?
I am using RH9, postgreSQL and perl5. Is it possible to get users to submit multiple page web-forms but not to pass values from one form to the next? I would like to store each page to the database server as it is submitted. Also, to build in the process to resume the web-form submission at a later time e.g say there are twent pages to submit and the user stops feeding the forms at the tenth form. I would like to email the user a reminder so he can log back in and start from the eleventh form. Can anyone tell me if this sort of thing is implemented anywhere, so I can study it. Or, can anyone p...

Passing data between web form pages without use of parameter/URL strings
Hi folks. I'd like to be able to pass data between web form pages (VB.NET, if it matters) without use of parameter strings in the URL (i.e. address?&parameter=value). If memory serves, it's possible to pass data 'behind the scenes'. How do I do that? If there's many ways of doing this, would you mind summarising each? In principle it sounds a more secure method than using parameters, which could be abused. Thanks. :) You can use session items. First Page Session.Item("Value1") = TextBox1.Text You can then refer to that session item in your other pages or use...

Passing form variable from page to page
I have application which requires to pass form variables from page to page.   Basically, it's registraion web site. I have 4 diffferent page which collect information from end user. For example: Page 1: default.aspx Page 2: Survey.aspx Page 3: Profile.aspxPage 4: Classes.aspxPage 5: payment.aspxPage 6: Finished.aspx So, at the end of page 6, i would like collect all the form variables and then insert into database. thanksaj This may not be the answer for which you're looking, but this might be wll suited to using a wizard all on one page.....just...

A page can have only one server-side Form tag
I have a web user control in my web page.  The user control (ascx) consist of a text box and button. The web page consist of text boxes and buttons also.  Both pages have form tags with runat=server.  When I run the web page it comes up with the error "A page can have only one server-side Form tag." Both the user control and web page need the form tag with runat=server.  Is there a way I can code these pages where there won't be a conflict between the web user control and the web page? Thanks   JohnMo wrote:Both the user control and web page need the form tag wit...

Passing a variable from page to page, OPTIONS? From VB page to C# page.
I currently use a querystring... would like this to be in the background however... can't (or would like to avoid) post because of how page 1 creates the variable... (its done with an old embeded activeX object - I'm grabbing an NDS login name, so the page has to post to create the variable, which is done via javascript)... suggestions? I looked into viewstate... but cant seem to get it to work... I'm guessing because its page only, yes?Thanks, JKC- Be a good developer, follow the W3C whenever you can. You can use a session variable.On page 1 set the session variable like thisC#Session["string"]="hello"; VBSession("string")="hello"On page 2 read the sesion variable like this:C#Response.Write(Session["string"].ToString()); VB Response.Write(Session("string").ToString()) Check below link Ways to pass data between webformsHC Haissam Abdul MalakMCAD.NET| Blog | You can use Page.PreviousPage property ...... On Page2 u can get values from page1 as    string value = ((textBox) PreviousPage.FindControl("ControlID")).Text ;   On Page 1  You will have to use Server.Transfer instead of Response.Redirect coz PreviousPage property doesn't get populated when using redirect method. Thanks.  Thanks.Please mark the post as answer if it helps you!!! ...

Who to passing a Variable One web page to other page ??
Who to passing a Variable One web page to other page ?? pl. also differant way of passing variable one page to other page If you find it absolutely necessary to pass values between pages (which is the Classic ASP way of dealing with things) you could read this: Passing Server Control Values Between PagesRegardsAndre Colbiornsen ---------------------------------Seventh DayRåbygatan 1A,SE-223 61 LundSwedenMob.: +46-(0)708-97 78 79Mail: info@seventhday.se--------------------------------...

pass value from web page to master page
Hi All,I m new to asp.net I m using login control but i m not using any provider or membership, as it is my requirmrnt I have a master page which has a menu control from there my user ca go to any page which he wants , after logging in. I want that when the user is logged in then his username should appear on the top of each page , so my question is "how to pass value from a web page to its master page?" I have tried something that is here. in Login page----- protected void lgnLogin_LoggedIn(object sender, EventArgs e)    {    &nbs...

Open a new page and pass parameters to this page
for the onclick event of a button, it can open a new web page (this page has been created in my project) and pass some parameters to this page. Does any one know the codes to implement this? Thanks! you can do http post or http get to pass data into another page to open new web page use javascript Use this javascript function<script language="JavaScript"><!--//function new_window(url) { link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=500,left=40,top=50"); } //--> </script> then you can e...

How to pass parameter from GV page to FV page?
I am trying to pass a GV.SelectedIndex value (when initiated by a button click in a column template) as a query parameter to populate a specific FV on a different page (CustomerDetail.aspx) by using ?id=. However, my .cs file code, below: protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("~/CustomerDetail.aspx?id=" + Convert.ToString(GridView1.SelectedIndex)); } does not seem to get called when the Button1 in the GV template is clicked. Thus, ?id=-1 when calling the CustomerDetail.aspx page.  I have tried to put a breakpoint on this statement, b...

Passing parameters from mater page to content page
Hi, I have a TreeView control in my master page which lists a set of report names. I am designing a content page which will show the detailed information about the selected report using CrystalReportViewer. What I want is, when user click the name of the report from TreeView control, I can pass the name of the report as a the reportID to the CrystalReportViewer to dynamically bind the date. I need find a way to pass parameters from master page to content page. Please advise, thanks a lot! Hey, If you create a public property on the master page, in the content page the Page object...

Passing parameters to a web page?
Hi, I have a situation where I need to invoke a web application from my PB 7 code. I can do it easily enough using the "HyperLinkToUrl()" function. My problem is that the web application needs login information. I can append the username and password to the URL and it will work fine, but then they both show up in the address bar of the browser. This, of course, is unacceptable. I thought maybe I could create an HTML document from within PB using "FileOpen()" and "FileWrite()" that would create a form with the username and password as hidden values ( the...

how to navigate the url page in one web application page to another web application page
In my project one solution have 2 web apllications in one folder.like 1.webapplication1 2.webapplication2. in firt webapplication1 i created one aspx page like sample.axpx. in second webapplication2 i created one aspx page like sample2.aspx... in sample2.aspx page have hyperlinl. I need to navigate this hyperlink when i click it go to the sample.axpx. how can i write navigate url for this...help me. ..thanks  As i understand u, you need Multi Project soltuionsee this link, http://community.rainbowportal.net/blogs/jonathans_rainbow_blog/archive/2006/02/19...

Could PB .NET Web Form POST security Information to others web page??
This is a multi-part message in MIME format. ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Hi,=20 Have anyone came across the requesion to POST security informations from = PB .NET web form web page to other web site?? I have tried many datys, Could any kind man give me some suggessions?? thanks & Best regards Leon ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML P...

I can t populate my Inout field (located on a first page) from a calendar pop-up page (which is my 2nd page) when my inout field is in a runat=server form
Hi,  I needed a basic popup calendar in order to select a date to populate my input field in the page main.aspx. But the code works for me only when the input field is in a non Runat=server form. I want to make it work also in a Runat=server form.Here is the code:In the calling page main.aspx I put the textbox to be populated  from the calendar of the second page calendar.aspxmain.aspx <form id=myNonServerForm name=myNonServerForm><input id= "myInput" type="text" name="inpDate1"><A href="javascript:calendar_window=win...

Response.Redirect in C# for page to page parameter passing
Looking for examples of this, but can't find anything specific. I'm new to ASP.NET, and C# at the same time... so I'm struggling to get it right...  Thanks, NickThanks...“To teach is to learn twice.” – Joseph Joubert Hi. You can pass parameters in the querystring: Response.redirect("otherpage.aspx?id=5") And in "otherpage.aspx" read the values: int id = Response.QueryString("id") Try the below code to redirect to a webform and pass a query string parameter Response.Redirect("WebForm2.aspx?id=123"); And on webform2.aspx, if you want to retreive the value for id use the below co...

Passing A Session Variable Form Page to Page ~ No Working
Hi All, I am trying to passing a session variable from Page to Page but its not working! the user basicaly logins in on the login.aspx and when their credentials are verifed by the MSSAccess database they are tehn redirected to the next page...heres a snip of code ~~~~~~~~~~~~~~ session("ID") = dslogin.tables("UserInfo").rows(0).item("ID") response.redirect("./success.aspx") ~~~~~~~~~~~~~~~~~~ Heres the code for the page I am trying to access after beigng verifed ~~~~~~~~~~ sub page_load(byval sender as object, b...

Passing Text Value From 2nd Page to Main Page
Hi guys, Really need help on this I have this set of input text with button : -                 <tr>                    <td width="13%" class="FormLabelColor"><asp:TextBox ID="lframePatno" runat="server" CssClass="FormInput"></asp:TextBox></td>                    <td width="12%" class="FormLabelC...

Web page opens second web page, how does first page know when the second one closes?
I have an app written in ASP.NET where one of the web pages opens up a web page in a second window.  When this second web page closes, the first web page needs to update its data.  How do you do this? You can have the child window call a parent method when the user clicks a link to close it. Otherwise, you'd have to set up polling to check for the existence of the child, and refresh if it doesn't exist. Please Mark As Answer posts that helped you."If we learn from our mistakes, I should be brilliant by now." Thanks, this gives me part of the answer...

page up / page down
Name: Kyle Morrison Email: kymorris_at_cisco.com Product: Deer Park Summary: page up / page down Comments: page up and page down do not work mac osx 10.3.9 Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+ ...

Web resources about - pass parameter captured from 1st page to the 2nd and then to the third page. - asp.net.web-forms

Parameter - Wikipedia, the free encyclopedia
A parameter (from the Ancient Greek παρά , "para", meaning "beside, subsidiary" and μέτρον , "metron", meaning "measure"), in its common meaning, ...

fb_source Parameter - Facebook-Entwickler
This document lists the complete list of values for the fb_source parameter that is returned with th...

Google Webmaster Tools Parameter Handling - Flickr - Photo Sharing!
You aren't signed in Sign In Help Home The Tour Sign Up Explore Explore Home Last 7 Days Interesting Popular Tags Calendar Most Recent Uploads ...

Cat 8: TIA performance standards committee chairman previews parameters of forthcoming twisted-pair cable ...
Category 8, the next-generation twisted-pair cabling specification, is still in development, but the outlook looks quite positive that it will ...

Philippine president asks for 'parameters' of Mayon Volcano tours
Philippine president asks for 'parameters' of Mayon Volcano tours People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, Apr, May, ...

Alternatives to boolean parameters
... ) { PrintLine ( item . Name ); if ( printDetails ) { PrintLine ( item . Description ); } } } Aha! Now can see that the boolean parameter ...

Exporting Error (Error in Parameter...: Apple Support Communities
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability ...

Apple tech monitors device aging, adjusts operating parameters to ensure optimal performance
... describing a method of monitoring the aging of a device's electronics, comparing the data with a global average and modifying operating parameters ...

Is it poor programming practice to pass parameters as objects?
... a free, community-powered network of 100+ Q&A sites . Risser asked: So, we've got a guy who likes to write methods that take Objects as parameters, ...

Parameter Short Film Competition sponsored by Grolsch
Grolsch presents Parameter The A.V. Club Short Film Competition Please Enter Your Date of Birth Ineligible entry Enter For people over the age ...

Resources last updated: 2/29/2016 10:32:18 PM