Can Href raise an event?

Discussion in 'ASP .Net Web Controls' started by Michael Tissington, May 7, 2004.

  1. What is the best way of doing this ....

    In my Page_Load event I am building a table with a number of <a> tags.

    On the page I have a Text box control.

    When the user clicks one of the <a> tags and they get href to another page
    and then want to access the value of the Text box control.

    Any ideas how to do this please?


    --
    Michael Tissington
    http://www.oaklodge.com
    http://www.tabtag.com
    Michael Tissington, May 7, 2004
    #1
    1. Advertising

  2. One way to do this would be the following:
    <a href="javascript:void(0);"
    onclick="window.location.href='/destination/path.aspx?textboxvalue=' +
    document.getElementById('TextBox1').value;">text link</a>

    Then in the destination page, you can access the value of the text box by
    using Request.Querystring.Item("textboxvalue") in the codebehind

    Hope this helps,
    Garett

    http://www.aimx.com
    There's no place like 127.0.0.1

    "Michael Tissington" <> wrote in message
    news:%...
    > What is the best way of doing this ....
    >
    > In my Page_Load event I am building a table with a number of <a> tags.
    >
    > On the page I have a Text box control.
    >
    > When the user clicks one of the <a> tags and they get href to another page
    > and then want to access the value of the Text box control.
    >
    > Any ideas how to do this please?
    >
    >
    > --
    > Michael Tissington
    > http://www.oaklodge.com
    > http://www.tabtag.com
    >
    >
    Garett Rogers, May 7, 2004
    #2
    1. Advertising

  3. Thanks - this is what I'm looking for but will this work with both IE and
    Netscape ?

    --
    Michael Tissington
    http://www.oaklodge.com
    http://www.tabtag.com

    "Garett Rogers" <> wrote in message
    news:...
    > One way to do this would be the following:
    > <a href="javascript:void(0);"
    > onclick="window.location.href='/destination/path.aspx?textboxvalue=' +
    > document.getElementById('TextBox1').value;">text link</a>
    >
    > Then in the destination page, you can access the value of the text box by
    > using Request.Querystring.Item("textboxvalue") in the codebehind
    >
    > Hope this helps,
    > Garett
    >
    > http://www.aimx.com
    > There's no place like 127.0.0.1
    >
    > "Michael Tissington" <> wrote in message
    > news:%...
    > > What is the best way of doing this ....
    > >
    > > In my Page_Load event I am building a table with a number of <a> tags.
    > >
    > > On the page I have a Text box control.
    > >
    > > When the user clicks one of the <a> tags and they get href to another

    page
    > > and then want to access the value of the Text box control.
    > >
    > > Any ideas how to do this please?
    > >
    > >
    > > --
    > > Michael Tissington
    > > http://www.oaklodge.com
    > > http://www.tabtag.com
    > >
    > >

    >
    >
    Michael Tissington, May 7, 2004
    #3
  4. for nescape you can replace document.getElementById('TextBox1').value with
    document.all['TextBox1'].value.

    other solution is :
    in table you can insert LinkButton instead <a/> tag. Add an event handler
    for click, or better command, and do this work inside this.

    private void link_click(object s, EventArgs e)
    {
    .....
    Response.Redirect(".......aspx?val=" + TextBox1.Text);
    }

    Brun

    "Michael Tissington" <> wrote in message
    news:...
    > Thanks - this is what I'm looking for but will this work with both IE and
    > Netscape ?
    >
    > --
    > Michael Tissington
    > http://www.oaklodge.com
    > http://www.tabtag.com
    >
    > "Garett Rogers" <> wrote in message
    > news:...
    > > One way to do this would be the following:
    > > <a href="javascript:void(0);"
    > > onclick="window.location.href='/destination/path.aspx?textboxvalue=' +
    > > document.getElementById('TextBox1').value;">text link</a>
    > >
    > > Then in the destination page, you can access the value of the text box

    by
    > > using Request.Querystring.Item("textboxvalue") in the codebehind
    > >
    > > Hope this helps,
    > > Garett
    > >
    > > http://www.aimx.com
    > > There's no place like 127.0.0.1
    > >
    > > "Michael Tissington" <> wrote in message
    > > news:%...
    > > > What is the best way of doing this ....
    > > >
    > > > In my Page_Load event I am building a table with a number of <a> tags.
    > > >
    > > > On the page I have a Text box control.
    > > >
    > > > When the user clicks one of the <a> tags and they get href to another

    > page
    > > > and then want to access the value of the Text box control.
    > > >
    > > > Any ideas how to do this please?
    > > >
    > > >
    > > > --
    > > > Michael Tissington
    > > > http://www.oaklodge.com
    > > > http://www.tabtag.com
    > > >
    > > >

    > >
    > >

    >
    >
    Bruno Sirianni, May 7, 2004
    #4
  5. Hi

    Nop document.all is IE only...

    This should work on most browsers

    document.forms["FORMNAME"].ELEMENTNAME.value

    --
    Best Regards
    Vidar Petursson
    ==============================
    Microsoft Scripting MVP
    http://www.microsoft.com/technet/scriptcenter
    ==============================
    "Bruno Sirianni" <> wrote in message
    news:U5Umc.160102$...
    > for nescape you can replace document.getElementById('TextBox1').value with
    > document.all['TextBox1'].value.
    >
    > other solution is :
    > in table you can insert LinkButton instead <a/> tag. Add an event handler
    > for click, or better command, and do this work inside this.
    >
    > private void link_click(object s, EventArgs e)
    > {
    > .....
    > Response.Redirect(".......aspx?val=" + TextBox1.Text);
    > }
    >
    > Brun
    >
    > "Michael Tissington" <> wrote in message
    > news:...
    >> Thanks - this is what I'm looking for but will this work with both IE and
    >> Netscape ?
    >>
    >> --
    >> Michael Tissington
    >> http://www.oaklodge.com
    >> http://www.tabtag.com
    >>
    >> "Garett Rogers" <> wrote in message
    >> news:...
    >> > One way to do this would be the following:
    >> > <a href="javascript:void(0);"
    >> > onclick="window.location.href='/destination/path.aspx?textboxvalue=' +
    >> > document.getElementById('TextBox1').value;">text link</a>
    >> >
    >> > Then in the destination page, you can access the value of the text box

    > by
    >> > using Request.Querystring.Item("textboxvalue") in the codebehind
    >> >
    >> > Hope this helps,
    >> > Garett
    >> >
    >> > http://www.aimx.com
    >> > There's no place like 127.0.0.1
    >> >
    >> > "Michael Tissington" <> wrote in message
    >> > news:%...
    >> > > What is the best way of doing this ....
    >> > >
    >> > > In my Page_Load event I am building a table with a number of <a>
    >> > > tags.
    >> > >
    >> > > On the page I have a Text box control.
    >> > >
    >> > > When the user clicks one of the <a> tags and they get href to another

    >> page
    >> > > and then want to access the value of the Text box control.
    >> > >
    >> > > Any ideas how to do this please?
    >> > >
    >> > >
    >> > > --
    >> > > Michael Tissington
    >> > > http://www.oaklodge.com
    >> > > http://www.tabtag.com
    >> > >
    >> > >
    >> >
    >> >

    >>
    >>

    >
    >
    Vidar Petursson, May 14, 2004
    #5
  6. use linkbutton instead to rise an event
    "Michael Tissington" <> wrote in message
    news:#...
    > What is the best way of doing this ....
    >
    > In my Page_Load event I am building a table with a number of <a> tags.
    >
    > On the page I have a Text box control.
    >
    > When the user clicks one of the <a> tags and they get href to another page
    > and then want to access the value of the Text box control.
    >
    > Any ideas how to do this please?
    >
    >
    > --
    > Michael Tissington
    > http://www.oaklodge.com
    > http://www.tabtag.com
    >
    >
    Hüseyin Bilkut Þýhmanoðlu, May 23, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Tissington

    Can Href raise an event?

    Michael Tissington, May 7, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    543
    Hüseyin Bilkut Þýhmanoðlu
    May 23, 2004
  2. Jacol

    raise or not to raise [Newbie]

    Jacol, Feb 3, 2007, in forum: Python
    Replies:
    5
    Views:
    402
    Gabriel Genellina
    Feb 5, 2007
  3. ernest
    Replies:
    2
    Views:
    286
    Roy Smith
    Nov 14, 2010
  4. Jack Bates
    Replies:
    0
    Views:
    276
    Jack Bates
    May 2, 2011
  5. bvdp

    Raise X or Raise X()?

    bvdp, Mar 11, 2012, in forum: Python
    Replies:
    10
    Views:
    361
    Stefan Behnel
    Mar 12, 2012
Loading...

Share This Page