SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fill text box value on next page

    Hi,

    I am new to ASP.Net.

    I have a website with Search Keyword form in header of all pages. When a visitor enters a keyword in input box and submits the form; on next page I want the text box to automatically fill the searched keyword.

    Example:
    <Form action="search.aspx">
    <INPUT type="text" name="txtKeyword" id="txtKeyword" value="" />
    <INPUT type="submit" value="Submit" />
    </Form>

  2. #2
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,880
    Mentioned
    48 Post(s)
    Tagged
    0 Thread(s)
    Well, that depends on how you doing the redirect from the previous form. How are you posting the search term from the previous form?

    It would generally be either a GET or POST method.

    To load the textbox you can do this:
    txtKeyword.Value = Request.QueryString["txtKeyword"];

    or

    txtKeyword.Value = Request.Form["txtKeyword"];

    or you could just do the following that will work for both GET and POST params

    txtKeyword.Value = Request["txtKeyword"];

    And all of these would be put in the pageLoad method.

    I hope this helps

  3. #3
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Note that the input text box is not ASP Textbox control.

  4. #4
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,880
    Mentioned
    48 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by itHighway View Post
    Note that the input text box is not ASP Textbox control.
    Yes. I know it is not an ASP.NET textbox control. Thats why it is txtKeyword.Value if it was a ASP.NET textbox control you would set it with txtKeyword.Text


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •