Postback

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Wilmot

    #1

    Postback

    Can anyone help with this one.

    I have a Text box called txt_Query and when I do a postback on the page I
    want to grab the text from this box as it contains criteria that I need to
    run the appropriate Query

    I have tried without Success
    Dim Query As String = Request.Params. Item("txt_Query ")

    Can anyone tell me how to get the value of this text field

    Thanks in advance

    Chris Wilmot


  • Ravikanth[MVP]

    #2
    Postback

    Hi

    Try this:
    Dim Query As String = txt_Query.Text;

    Ravikanth[MVP]

    [color=blue]
    >-----Original Message-----
    >Can anyone help with this one.
    >
    >I have a Text box called txt_Query and when I do a[/color]
    postback on the page I[color=blue]
    >want to grab the text from this box as it contains[/color]
    criteria that I need to[color=blue]
    >run the appropriate Query
    >
    >I have tried without Success
    >Dim Query As String = Request.Params. Item("txt_Query ")
    >
    >Can anyone tell me how to get the value of this text[/color]
    field[color=blue]
    >
    >Thanks in advance
    >
    >Chris Wilmot
    >
    >
    >.
    >[/color]

    Comment

    • Kevin Spencer

      #3
      Re: Postback

      Hi Chris,

      Try Request.Form("T extBoxName") - Note that I put "Name" in there, because
      the id property is not passed back in the Request.Form collection; the name
      property is.

      --
      HTH,

      Kevin Spencer
      Microsoft MVP
      ..Net Developer
      All hotels in Benidorm. The best selection of Benidorm hotels with reviews and maps. Book in advance and save.

      Neither a follower nor a lender be.

      "Chris Wilmot" <chris.wilmot@m tsgroup.co.uk> wrote in message
      news:%23ENDvJWZ DHA.1916@TK2MSF TNGP12.phx.gbl. ..[color=blue]
      > Can anyone help with this one.
      >
      > I have a Text box called txt_Query and when I do a postback on the page I
      > want to grab the text from this box as it contains criteria that I need to
      > run the appropriate Query
      >
      > I have tried without Success
      > Dim Query As String = Request.Params. Item("txt_Query ")
      >
      > Can anyone tell me how to get the value of this text field
      >
      > Thanks in advance
      >
      > Chris Wilmot
      >
      >[/color]


      Comment

      • John Saunders

        #4
        Re: Postback

        "Chris Wilmot" <chris.wilmot@m tsgroup.co.uk> wrote in message
        news:%23eMPtwWZ DHA.2032@TK2MSF TNGP10.phx.gbl. ..[color=blue]
        > Unfortunatly that does not work as it is within the onload section and has
        > not assigned the text to the text box at that point, also the value may be
        > posted through from the previous page.[/color]

        txt_Query.Text should work in OnLoad.

        Are you loading the data within a "if (!IsPostBack)" block?
        --
        John Saunders
        Internet Engineer
        john.saunders@s urfcontrol.com


        Comment

        • John Saunders

          #5
          Re: Postback

          "Chris Wilmot" <chris.wilmot@m tsgroup.co.uk> wrote in message
          news:%23eMPtwWZ DHA.2032@TK2MSF TNGP10.phx.gbl. ..[color=blue]
          > Unfortunatly that does not work as it is within the onload section and has
          > not assigned the text to the text box at that point, also the value may be
          > posted through from the previous page.[/color]

          txt_Query.Text should work in OnLoad.

          Are you loading the data within a "if (!IsPostBack)" block?
          --
          John Saunders
          Internet Engineer
          john.saunders@s urfcontrol.com


          Comment

          Working...