.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Retrieving a variable from a previous page

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net


I'm looking to have a search page where a user will select an item from a listview, then then taken to another page that wil display data based on their original selection.

A user will type in a string and be presented with a list of usernames that are like that string, when they select a user name who's profile they would like to view I would like the page that they're taken to, to be that users profile.

How would I transfer the variable from the search page to the profile page, and when I work on the profile page, how can I access that variable?


View Complete Post

More Related Resource Links

Retrieving values from previous page

Hey Forumers,Here is the case, I have a datalist displaying a whole list of text files and I have a hyperlink with the title as the text and a navigateUrl that navigates the user to a page to display the file the user chose.I have coded the hyperlink like so:<asp:HyperLink ID="HyperLink2" runat="server" Text='<%# Eval("Title") %>' NavigateUrl='<%# Eval("StoryID", "StoryDisplay.aspx?StoryID={0}") %>'>Hyperlink</asp:HyperLink>The problem I am facing is that I got this code snippet from another source and I don't know what does the StoryID={0} means. I do know that the eval statement would sent the storyID of the selected file to StoryDisplay.aspx, I just don't know how to retrieve the values from the second page.P.S. the second page contains a title label and an area(enclosed in <div> tags) for the selected text to be displayed.Please help and thanks in advance =)Cheers,Zephere

ASP.net Web Site Administration Tool. An error was encountered. Please return to the previous page a

I have just installed Visual Studio 2010 trial. Previously I have been using Visual Studio Web Developer 2010 Express. Now every time I try to invoke the ASP.net Cofiguration tool either via the icon or through the Project File Menu item, I get the error message "An error was encountered. Please return to the previous page and try again." I am trying to develop a bog standard Silverlight Business Application. There are no other diagnostics. Is there anywhere I can look for more clues or anything else to do to alleviate the problem? or is this something peculiar to the trial version I am using?   I also think it might have something to do with the fact that I have created this Silverlight Business App on a directory on my D: drive and not the normal, default c: drive path and maybe the web sit admin tool is looking somewhere else. Could this have something to do with it? If so what is my remedy?   Help please.....

How to catch error in session variable in globals.asax(Application_Error) and redirect to same page

Hi, i have a login page where username got to enter his/her username or password. When you try to enter any scripting over there eg:'<asd>' it gives an error  'Server Error in '/' Application' 'A Potentially dangerous Request. Form value was detected from client' I don't want to redirect user to custom error page when such unpredictable error occurs. infact i got a label on the same page itself where error's are displayed. how can i display such errors on this very same label. can i do that using globals Application_Error ?. Session variable not working here. Please give me the exact steps for how i can catch and display the error which are not validated. waiting for reply thanks and regards, Learning Programmer

logout problem(after logout when clicking on back button after logout still opens the previous page

I am using ASP.NET, the web page is abandoning and clear session when a user click logout link but they click the back button and it is still showing the previous page. How can it prevent the previous page after logout?on Logout.aspx load im using this code//=================//        Session.Clear();        Response.Buffer = true;        Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D);        Response.Expires = -1500;        Response.CacheControl = "no-cache";        //----- Second Technique : To Stop Caching of Secure Pages.        Response.Cache.SetCacheability(HttpCacheability.NoCache);        FormsAuthentication.SignOut();        if (Session["UserName"] == null)        {            Response.Redirect("login.aspx");        }       Session.Clear();         Response.Buffer = true;         Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D);         Response.Expires = -1500;         Response.CacheControl = "no-cac

Recover data on a Previous Page after navigating from the page and navigating back

How can i recover the data on Page1 after navigating to Page2, so that when i navigate to Page1 from Page 2 i want the unsaved data as is.

Retrieve Previous State Data on return from another page


I have a list page having date in repeater control. And also having some search criteria on the page. Using that I filter the data on the page. Now in repeater I have Edit button. Which allows me to open that record details in another page.
When I come back to list after saving or cancel, the filtered data is gone. I want to keep that filtered record with selected values in filter controls (checkbox, dropdown etc).
I have two options in my mind 1) Session, 2)

can't retrieve session variable from another page


i'm a asp.net c# beginner, i set a session variable in a.aspx but it's null when i try to retrieve it in b.aspx 

anyone could help please!!! thx


I need to pass a variable from a url to an .aspx search/results page


When I was using FrontPage, a .asp page would receive a varialbe from the url when ?field=value was added to the end of the url.  I am now using Expression Web and have found that this doesn't work with .aspx pages.  Can anyone tell me what code needs to be added to the page to accomplish this with .aspx?  I create the .aspx page with VB as the coding selection.

I am not sure what forum this should be in.



Eleanor V

Variable to Store temporary page data


I'm working on a web page that is going to be used to enter data into a database. The page is going to be dynamic in that the user has the ability to add a row to the table with the same fields, ie lname1, fname1, mi1 then lname2, fname2, mi2

I'm wanting to use a variable to keep track of how many lines there are so that when I generate the added line I am creating a new field with the ID of lname+# . Whats the best way to do this, a global variable, session variable? As side note, first time programming in .Net or C# so I apologize for my lack of knowledge.

After Login , Redirect To Previous Page Instead Of Destination URL set


Hi .

I have developed an asp.net project with asp.net membership for login.

I have login control in a page and for that I have set the property destination URL to a particular page say defaultlogin.aspx.

It is also working fine, when I use to login from home page.

But if i navigate to different pages of my website say first to home page, contact us page, about us page etc. Then after that when I click on login page and key up the login information in the login control.

I use to redirect to the last page which I have visited the last. It is not redirecting to the destination page which I have set in the login control.

What's the problem here?

Plz help me with the above issue.

Thanx in advance.

How to pass a variable from parent to the hosted page in a frame. (Cross Posted due no reply from (V



I have - what might look like an obvious question - for me it is a headache.

Some background info:

In a WPF Window, I have placed a frame. A Ribbon button in the WPF window executes NavigationServices as you can see below. Mind there is no navigation History (back/Forward).

    Private Sub rTabToolsRgpSystemAdministrationRbtnPolicyEditor_Click(ByVal sender As ObjectByVal e As System.Windows.RoutedEventArgsHandles rTabToolsRgpSystemAdministrationRbtnPolicyEditor.Click
        InsertNavigationAction("Policy Editor")
        piFrame.NavigationService.Navigate(New System.Uri("piPolicyEditor.xaml"UriKind.Relative))

I am trying to pass a string variable (s

How do I get Previous Page's URL?


I want to make a Return column visible on my GridView based on a condition, but I want the NavigateUrl to be the previouspage URL plus the ID that I am sending back to that page.

Currently, I use this:
Dim previousPage As String = Page.Request.UrlReferrer.ToString

This gives me the previous referral page's URL, BUT... if I hit Find to search for something and then the search lists to my GridView, previousPage errors with a Object Not Set to Instance, etc. Error. Why is this? And does anyone have a way of grabbing the previous page URL?

How do define a global variable in a page



I have to define a global and unchangeable variable in a web page. I used static variable but its content is the same for all users that use the page and it is bad. I dont want use Session variable.

Any idea?

The Application variable's value assignment in asp page not reflecting in .aspx page.


We are migrating ASP application into ASP.Net. We are migrating module by module.

In our application we are using Application variable in global.asax. like below, 

Application("ABC") = "Not Avail."

Application("DEF") = "Not Avail." 

One of the existing ASP page assigning the value for this Application variable like below,

Application("ABC") = "ABC"

Application("DEF") = "DEF" 

The newly assigned value for this Application variables only coming in .asp pages not in .aspx pages. 

Is there any limitation in Application variables like .asp code application assignment will not reflect in .aspx pages?

while running new report, doesn't indicate if previous report preview page is open



i am using asp.net to run the reports from the parameter page.

When i run a report by passing report parameters, the reporting services report opens in the report_preview.aspx page.

 Now, if i do not close this report_preview.aspx page and go to new parameter page and run another report, the report_preview.aspx page doesn't show the new report. It just refreshes the old report.

This can be because, when the run button of any parameter page is executed, it opens the report_preview.aspx page by executing the following query under page_load button.

            ScriptManager.RegisterStartupScript(this, typeof(string), "openNewWindow", "window.open('../Report_Preview.aspx','ReportPreview','scrollbars=yes,resizable=yes,')", true);

But clients get confused for everytime to close previous preview page and open the new report.

IS there any way to handle it please

Is there any way to generate the new ssrs report on the same report_preview.aspx page by refreshing it ( by replacing previous report by the new one) ?


Load Previous ASPX Page while click on Javascript History.Back


Hi All,

I am stuck with a unusual Scenario, I have Default.aspx page which contains a Search criteria option and Gridview, After doing particular search result is displayed in Gridview .

When i click on selectedindexchanged event of Gridview it takes me to another page called Details.aspx where there is form in edit mode where the user can update and save the data into a database . In Details.aspx page i have link button which have history.back function which takes me to default.aspx page where i can retain my Search criteria and Gridview Result but my query is when click on Link button i want to call any of the Events of Default.aspx page.

Thanks in Advance


default ASPX Publishing page will not restore to previous version

I have inherited a MOSS farm that has a semi customized front page on it's publishing portal. One of the customizations is a bamboo web part that someone did something to to cause it to change the font on it to white and collapse if it had no information in it. I restored this whole site collection to a test area in a separate application pool so that I could work on it without disturbing any other users.  The Bamboo licensing broke in this web application even though the farm is licensed. I was just going to ignore that for now and concentrated on adding some web parts controlled by audiences. I got the web parts in and reacting to the correct audience but then I screwed around with it long enough to break it.

Now the customized Bamboo does not collapse and is stuck showing it's error message about the licensing, and I am unable to change the height of other web parts although I am able to change the width.

So (and here is the real problem) I thought that I would just restore a previous version of the page and try again after I got the licensing with Bamboo all straightened out. But I cannot get this page to restore an old version.

First when I was on the page showing all of the versions for this page and I would choose an older version it would complain that I had to check out the page before making any changes. SO I check out the page and return
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend