473,800 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6087
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******@noema il.noemailwrote in message
news:36******** *************** ***********@mic rosoft.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.dt d">

<script runat="server">

protected void LinkButton1_Cli ck(object sender, EventArgs e)
{
MultiView1.Acti veViewIndex = 1;
}

protected void LinkButton2_Cli ck(object sender, EventArgs e)
{
MultiView1.Acti veViewIndex = 0;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:MultiVie w ActiveViewIndex =0 ID="MultiView1 " runat="server">
<asp:View ID="View1" runat="server">
View1<asp:TextB ox ID="TextBox1"
runat="server"> </asp:TextBox>
<asp:LinkButt on ID="LinkButton1 " runat="server"
OnClick="LinkBu tton1_Click">Li nkButton</asp:LinkButton> </asp:View>
<asp:View ID="View2" runat="server">
View2<asp:TextB ox ID="TextBox2"
runat="server"> </asp:TextBox>
<asp:LinkButt on ID="LinkButton2 " runat="server"
OnClick="LinkBu tton2_Click">Li nkButton</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
1911
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 href="javascript:submit();" onMouseOver="MM_swapImage('Image1221','','images/btn_green_on.gif',1)" onMouseOut="MM_swapImgRestore()" id="A1" runat="server"> Next <img src="images/btn_green.gif" alt="Next" name="Image1221" width="16" height="16"...
2
5598
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 a few seconds. The js function simply sets the css style to display. <asp:TemplateColumn> <ItemTemplate> <asp:LinkButton Runat="server" CommandName="Select" ID="lbtnCompanyName"> <%# DataBinder.Eval(Container.DataItem, "CompanyName")%>...
3
3989
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: Cell.Controls.Add(deleteRecipientLink(objReader("NotificationID"))) I feed it with an ID from my database table.
5
1820
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 as to why it doesn't work? It's nearly a copy of some sample code that I lifted from a friend, whose code works (so he says!). By the way, I'm using a dotnet Table control in the ASPX page which starts off empty, it's ID is dirTable. By the...
1
3709
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 the clicking of the LinkButton to call the click event handler to execute some code, then redirect to another page, but the other page is in the new browser window. And, we don't want to use JavaScript, such as:
2
29496
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 "Finish") after some time, 10 minute or so, which be equal like click on submit button and terminate quiz (open another page or so). I tried to solve it by JavaScript but won't, always error, like can't detect button like object. What to do? Listing...
1
327
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. ----------------------------------- <asp:LinkButton ID="lkbShop" OnClick="BackToShop" PostBackUrl="Shop.aspx" runat="server"/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:LinkButton ID="lkbSubmit" PostBackUrl="ProcessOrder.aspx" Text="SUBMIT ORDER" runat="server"/>
0
1535
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, my web page has 2 forms - one 'runat' server and one HTML form. On a button click in the 'runat' form, I want to POST to the HTML form (which in turn calls my php method).
2
1996
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 won't be able to follow the links. Where possible I have used normal links that change the query string of the page, however some things, such as submitting forms are impossible.
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10501
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10250
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7574
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.