473,327 Members | 2,055 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,327 software developers and data experts.

Simulate linkbutton click on submit

I have two sets of search criteria on my page.
They are placed inside two DIV tags made visible/hidden by a client script.
In each DIV tag I have a LinkButton that performs the search from each set.

By using AJAX I get the resulting list expand and collapse without page
reload.
All work smoothly.

But one user today complained that the submit behaviour doesn't work like
before.
When hitting the ENTER key the LinkButton is NOT fired making a new search
based on the criteria. Instead the first node in the current repeater set is
expanded.

Can I decide that my LinkButton should be fired when the user is hitting his
ENTER button?

Apr 26 '07 #1
3 6034
His problem may be that the focus has been set on the first item in the
repeater. You can search for scripts that will allow you to set focus on
ASP.Net objects. This would give you the ability to set focus on the enter
button right away. It could also be that the user is tabbing around before
getting to the linkbutton and thus has set the focus themselves on the first
row without realizing it.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jakob Lithner" <ja******@noemail.noemailwrote in message
news:36**********************************@microsof t.com...
>I have two sets of search criteria on my page.
They are placed inside two DIV tags made visible/hidden by a client
script.
In each DIV tag I have a LinkButton that performs the search from each
set.

By using AJAX I get the resulting list expand and collapse without page
reload.
All work smoothly.

But one user today complained that the submit behaviour doesn't work like
before.
When hitting the ENTER key the LinkButton is NOT fired making a new search
based on the criteria. Instead the first node in the current repeater set
is
expanded.

Can I decide that my LinkButton should be fired when the user is hitting
his
ENTER button?

Apr 26 '07 #2
Hello,

Do you mean that when focus is on the LinkButton, press ENTER doesn't cause
the LinkButton's Click event gets fired on server?

If you mean that when the focus is in a INPUT field and you press ENTER,
based on my test, the LinkButton will not be "clicked" when you press ENTER
on a INPUT field, the form is submitted but the LinkButton is not clicked:

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void LinkButton1_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 1;
}

protected void LinkButton2_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 0;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:MultiView ActiveViewIndex=0 ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
View1<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
<asp:LinkButton ID="LinkButton1" runat="server"
OnClick="LinkButton1_Click">LinkButton</asp:LinkButton></asp:View>
<asp:View ID="View2" runat="server">
View2<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>
<asp:LinkButton ID="LinkButton2" runat="server"
OnClick="LinkButton2_Click">LinkButton</asp:LinkButton></asp:View>
</asp:MultiView>
<asp:Button ID="Button1" runat="server" Text="Button" /></div>
</form>
</body>
</html>
AJAX doesn't change much here: pressing ENTER will cause the form submit to
server, but the LinkButton's click event isn't fired.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 27 '07 #3
Hi,

Have you seen my last reply? Please feel free to let me know if there's
anything unclear. Thanks.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 2 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: charliewest | last post by:
I am trying use server controls or web controls to simulate the following behavior. I've an image wrapped w/in a link to create a rollover effect as if both elements we're one graphic: <a...
2
by: Dave | last post by:
Hi, I have a datagrid with a Templated column below. I want to execute some javascript before the postback to show a hidden "div" tag with static message of "Please Wait..." since the query takes...
3
by: Rob Meade | last post by:
Hi all, I have a bit of code that programmatically adds some table cells/rows to a table. The last cell adds a LinkButton control, I call it like this: ...
5
by: Steve Harclerode | last post by:
Here's some code that I'm using to create a simple list of logical drive letters (my web application impersonates a user). I'm finding that my event handler doesn't fire. Can anyone give me a hint...
1
by: nwa | last post by:
Using the LinkButton control on a web form, how can I make the clicking of it open a new browser instance? I know how to do it with the normal anchor tag, but not this ASP.NET control. I need...
2
by: Eli | last post by:
HI! I made some quiz using one HTML form (few question with few radio-button each like potential answers) that have one Submit button. I would like to simulate click on this button (e.g. named...
1
by: rn5a | last post by:
A web page has 2 LinkButtons. When the 1st one is clicked, users are taken to Shop.aspx & when the 2nd one is clicked, users are taken to another ASPX page named ProcessOrder.aspx. ...
0
by: nospam | last post by:
Hello, I want to simulate posting to a form method with some data. I don't want to use query strings. I want to 'submit' to a php method with some form fields filled out on the server. So,...
2
by: =?Utf-8?B?TWFyYyBXaWNrZW5z?= | last post by:
Hi I have noticed that the LinkButton creates a hyperklink to a javascript location .e.g. <a href="javascript:__dopostback" This is bad for accessability because browsers without Javascript...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.