By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,813 Members | 2,269 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,813 IT Pros & Developers. It's quick & easy.

Can Href raise an event?

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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" <mi*****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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

Nov 18 '05 #2

P: n/a
Same idea as the first reply but doing it server-side using web server controls..

You could build your table using LinkButton controls instead of <a>...then you can use the click event of the LinkButton controls to access the TextBox control. Once you have the value from the TextBox, use it to build a link to the destination page by appending it. Then in the destination page, use Request.Querystring to access the value

LinkButton docs..

http://msdn.microsoft.com/library/de...webcontrol.asp
Nov 18 '05 #3

P: n/a
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" <no************@nospam.aimx.com> wrote in message
news:eA**************@TK2MSFTNGP12.phx.gbl...
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" <mi*****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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


Nov 18 '05 #4

P: n/a
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" <mi*****@nospam.com> wrote in message
news:eD**************@TK2MSFTNGP09.phx.gbl...
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" <no************@nospam.aimx.com> wrote in message
news:eA**************@TK2MSFTNGP12.phx.gbl...
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" <mi*****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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



Nov 18 '05 #5

P: n/a
Hi Michael,

Does the community's reply make sense to you? Do you still have concern on
this issue?

Please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #6

P: n/a
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" <br***********@virgilio.it> wrote in message
news:U5**********************@news3.tin.it...
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" <mi*****@nospam.com> wrote in message
news:eD**************@TK2MSFTNGP09.phx.gbl...
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" <no************@nospam.aimx.com> wrote in message
news:eA**************@TK2MSFTNGP12.phx.gbl...
> 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" <mi*****@nospam.com> wrote in message
> news:%2****************@TK2MSFTNGP12.phx.gbl...
> > 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
> >
> >
>
>



Nov 18 '05 #7

P: n/a
use linkbutton instead to rise an event
"Michael Tissington" <mi*****@nospam.com> wrote in message
news:#K**************@TK2MSFTNGP12.phx.gbl...
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

Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.