 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 29th, 2004, 10:26 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Enter Key
Hello,
What I want to do is something like this in an ASP.NET web form:
http://p2p.wrox.com/topic.asp?TOPIC_ID=16472
However, mine is a little different. What I want to do is when the enter key is pressed in a textbox, I want a link to be clicked through javascript.
Any ideas? Is that clear?
Brian
__________________
Brian
|
|

July 29th, 2004, 11:38 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Just make the javascript that is called:
document.location.href = "anotherpage.aspx";
|
|

July 29th, 2004, 11:59 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
It needs to generate server-side script... I should have clarified when I said earlier, that it needs to click a LinkButton.
|
|

July 29th, 2004, 03:10 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
I *think* you might be able to do something like this on the client side:
myLinkButton.click();
I know you can do this with a button, but I'm not positive about doing so with an <a> link.
|
|

August 2nd, 2004, 03:13 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hello,
It seems a little weird. When I just do:
if ( event.keyCode == 13 ) {
document.getElementById('lnkButton').click();
}
It doesn't work. However, when I do:
if ( event.keyCode == 13 ) {
document.getElementById('lnkButton').click();
if (document.getElementById('lnkButton') == null ) {
alert("NULL");
}
}
It works. It seems to be because of the alert. Something with the alert is causing it to work. I really don't want to do the alert, just in case for some reason it is null, and that message shows. Is there another way. If not, I can live with it.
I'm declaring an onKeyPress by:
txtDefSearchText.Attributes.Add("onKeyPress", "Search();")
In the Page_Load event. In addition, the above code is within the Search.
Brian
|
|

August 3rd, 2004, 01:12 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
Correction, the second one didn't work like it was yesterday... Although yesterday during testing when I popped up an alert, no matter if the linkbutton reference existed or not, the alert popped up and it committed the search. It seems like the alert gets it "over the hump" so to speak. Any ideas why?
Brian
|
|
 |