473,394 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Can Href raise an event?

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
7 1502
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan Cimpoiesu | last post by:
I have a remoting object, derived from MarshalByRefComponent, that I instantiate on the client side, with Activator.GetObject. Can I receive events fired on the server, on the client? How?
2
by: IcedCrow | last post by:
Subject says it all. I want to raise an event in Sub New of a class but it is not being raised to my client app. I can raise events just fine in other procedures... just not sub new. Why is...
12
by: Vittorio Pavesi | last post by:
Hello, is it possible to manually raise the event Elapsed of the timer object ? Vittorio
4
by: Jeremy | last post by:
I have a combobox with a SelectionChangeCommitted event handler, and am having a problem raising this event. For example, raiseEvent mycombobox.SelectionChangeCommitted gives me an error...
2
by: Pietro | last post by:
Hello, somebody know how to raise an event from a nested class? I have two classes, the class1 with 1 events, and a nested class (class2) inside the class1. So... How can I raise class1 events...
1
by: Anonieko | last post by:
I know Visual Studio lacked support on easily writing code to raise events from a ascx user control ( because you have to hand write them)....
3
by: =?Utf-8?B?Ulc=?= | last post by:
I constructed a new Class with some private members. I would like an event to be raised on the moment the value of one of those private members is changed. How do I define an event for that...
5
by: Mike | last post by:
Hi group; Let say I have an object called Account, that raises an event called AccountLow with its owns EventArgs, and when this event gets raised, I will like to raise another custom...
2
by: Sin Jeong-hun | last post by:
Suppose class Engine do something in another thread and raise events. class Engine { Thread Worker; public event ... EngineMessage; public void Start() { Worker=new Thread(new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.