.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 values from previous page

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :ASP.Net
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

View Complete Post

More Related Resource Links

Retrieving a variable from a previous page



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?


update parentpage gridview with the values from child page?


hi   i am having a gridview on each row i am having a update and add button.

on click of either of the button i am opening a popup where the end user will enter data and on clck of ok button in the child page

based on the click ie

if i clicked update i need to update that particular row with the values from child page.

if i clicked on add i need to add a row below the row where i clicked add button .

can anyone help me with this?

Retain DropDown,TextBox's previously selected values after redirected from another page.


 Hi People, How are you all doing?

I have 2 pages one is SearchPage & It has DropDowns, textboxes to specify the search criteria. From the search result the user is redirected to another page when he clicks the hyperlink in the search result  where he fills in the information and again redirected to SearchPage. Now the SearchPage is posted back with no state i just want to retain the search criteria and display when user comes back. Please give me some suggestion how to get this done. I've used ViewState to save the values and check them in Page_Load but they are null.   



 Update: I've come up with this code. But the problem is The values are being retained but the Button_Click event is not being handled properly. When i Check the code even after this "DropDownList1.SelectedValue = Session["Name"].ToString();" DownList1.SelectedValue is EMPTY"" samw with DropDownList2 . please Suggest something


    protected void Page_Load(object sender, EventArgs e)
        if (IsControlsEmpty())
            if (SessionExist())
                DropDownList1.SelectedValue = Session["Name"].ToString()

Control Values When Returning to Page


Why do controls value not persist when returning to a page (e.g. via browser back button)?  If I set control values without utilizing a post back the controls will maintain their last value when I return to the page.  If I set a control value and then call a post back, the control value is reset to the default value when returning.

I have many pages with a gridview, and a textbox which is used to filter the gridview contents.  I set the filter textbox, filter the gridview (postback), go to another page, and when I return to the gridview page (via back button), my filter textbox is reset empty, and the gridview is the original (unfiltered) data.

What concept am I missing here?

Thanks in advance...

Passing values from web page to custom security trimmer in SharePoint 2010

Hi, In SharePoint 2007 we had a custom security trimmer that implemented ISecurityTrimmer interface. We also had a custom webpart used for search. Now, using HttpContext we passed values from the webpart to security trimmer with additional info needed to trim the results. It worked since trimmer was executed in the same w3wp process as webpart. Now in SharePoint 2010, the architecture for ISecurityTrimmer2 has changed, as it's executed in search process (other w3wp) - not the webpart w3wp so it has no access to the HttpContext. Question is: how to pass custom data, in form of the string, to a security trimmer when search is done from custom code in webart?

Retrieving values from App_LocalResources

 I have an application where I store  textfields   in  local resource  folder say App_LocalResources with keys   Now i want to retrieve it using  GetLocalResourceObject  methord But it did't work  Can any body tell me how to retrieve values from local resource files where i have more than one files with same keys   thanks in advance

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 duplicate values to a new repeating section from a previous one?

It's nice to have repeating section. Is there any easy way to duplicate values from a previous section to a new one, even with manual process (eg, click a button)? THanks,

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)

Transfer values from one page to another Request Object



I wanTransfer values from one page to another using Request Object

but when i try store

textBox value into Request object like..

Request["Name"] = txtName.Text;

i get the following Error

Property or indexer 'System.Web.HttpRequest.this[string]' cannot be assigned to -- it is read only

Is Request object allows us to store values init like Session & Application Object............

Transfer values from one page to another Request Object



I want to Transfer values from one page to another using Request Object

but when i try store

textBox value into Request object like..

Request["Name"] = txtName.Text;

i get the following Error

Property or indexer 'System.Web.HttpRequest.this[string]' cannot be assigned to -- it is read only

Is Request object allows us to store values init like Session & Application Object............
Taha Zubair Ahmed Software Emgineer.

datareader problem while retrieving values??


I am getting error while inserting records into db whenever i want to check for duplicate values i am getting error like whatever i insert into the textbox it should check with db and if the value exists it has to show error,but at dr im always having first row value in the database i dont  know why

 SqlDataReader dr;
             SqlCommand cmd2=new SqlCommand("select * from emp",con);
         if (dr.HasRows)

    //             string empid=dr["empid"].ToString();
                 if (TextBox1.Text == dr[0].ToString())

                     Response.Write("id already exists");


                     int i = cmd.ExecuteNonQuery();
                     if (i == 1)

                         Response.Write("values inserted");
                         Response.Write("values not inserted");





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.

load new page and populate the values without database



I'm creating a website of 5 pages using c# (asp.net).

How do i link 2 pages, ie., on click of a button on first page should take me to second page.

Advance thanks,


Publishin page layout, that add/update values in a metadata of the page not working


We have custom control on Publishin page layout, that add/update values in a metadata of the page. Code is written in 'Button click' event that update/add new values to the metadata. Following is the code snippet, which is working fine in Stage and Acceptance servers. Publishin page doesn't update Draft version with SPListItem.SystemUpdate instead it updates to last published major version.

currentPublishingPage = PublishingPage.GetPubl
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