Button Click Event Doesn't Fire?

Jan 15, 2011

i have a JQuery ui dialog box that opens up as a contact form when a link is clicked, which works fine, my problem is trying to submit the information.

When you click the send button it fires a button click event of another asp:button ive got hidden on the page...

the post back event fires and the page reloads but the asp:button click event doesn't not fire?

Heres my code:

asp:Button is as follows:

Code:

[code]....

View 11 Replies


Similar Messages:

Web Forms :: When Click Any Button Or Linkbutton, It Doesn't Fire Any Event Or Doesn't Postback

Mar 22, 2010

In my project when i click any button or linkbutton, it doesnt fire any event or doesnt postback.

It was working fine but now it hv problem like this.

I think i have changed some settings by mistake.

View 5 Replies

Web Forms :: Button Click Event Doesn't Fire On First Click?

Mar 24, 2011

I have to click twice on button control to fire an event.

View 6 Replies

JQuery :: Click Event Doesn't Fire After Postback?

Aug 14, 2010

I have a small website where I want to display a confirmation dialog after clicking on a button.

When you click the confirmButton the dialog appears. Then you can choose between Yes or No to either continue with the PostBack or to return.

Problem: The first time you get into the site all works fine. But after you click Yes to continue with the PostBack, no click event will be triggered anymore.

Here is some code.

[Code]....

View 8 Replies

JQuery :: JavaScript Attached To Cancel Button (HTML Button) Click Doesn't Fire

Jun 20, 2010

I have a LoginView element in an Update panel and use JQuery to hide the div containing the update panel when the cancel button(Html) is clicked.

It works fine normally. However, when I enter an invalid password and there is an error message displayed, the Javascript attached to the Cancel button click stops firing.

[code]....

View 2 Replies

Web Forms :: User Control Click Event Doesn't Fire?

Mar 8, 2010

A little confused on something. I have a User Control in a master page. In the User Control there are image buttons. when I try to wire any click event even to say update a label in the User Control itself, nothing gets updated.

It is as if the postback is not handled at all.

What I want to do is click the image button in the User Control and then change a value in the master page. This could happen a few ways but for example it could update a public property or a control itself like a textbox or label.

View 4 Replies

Web Forms :: Button Doesn't Fire On First Click?

Dec 16, 2010

im using an update panel and my web form consists of textboxs and combo box, my problem is that when i click the button save for the first time, my page simply postbacks and the event save wouldnt fire, click it the second time and poof save will execute.. I notice that it is caused by my dropdown box and textbox autopostback function, i need to set this to true since i need to execute another function that will disable the dropdown when the textbox is filled and vice versa,set this to false and save will function normally..any ideas how to fix this?

here is the code for that.

<asp:DropDownList
ID="ddNewLocation"
runat="server"
Width="95%"
AutoPostBack="true"
AppendDataBoundItems="True"
onselectedindexchanged="ddNewLocation_SelectedIndexChanged">
<asp:TextBox
ID="txtNewLocation"
runat="server"
Width="90%"
AutoPostBack="true"
ontextchanged="txtNewLocation_TextChanged"></asp:TextBox>

View 5 Replies

Web Forms :: Button.Click Doesn't Fire

Nov 24, 2010

In my default Page I register this listener:

[Code]....

and this Event is never fired

[Code]....

View 42 Replies

Page Post Back But Server Click Event Doesn't Fire

Aug 31, 2010

I have a button like this:

<asp:Button ID="btnSave" runat="server" ClientIDMode="Static" Text="Save" OnClientClick="return ConfirmSave();" OnClick="btnSave_Click" />

If I write my client function like the following, it works as expected:

function ConfirmSave()
{
return confirm('Confirm?');
}

But I should check, inside the function, for the confirm result, like this:

function ConfirmSave()
{
if (Page_ClientValidate('validationGroup'))
{
var conf = confirm("Confirm?");
if (conf)
{
$('#btnSave').attr('disabled', 'disabled');
}
return conf;
}
else
return false;
}

Doing this, the page postback but the server click event doesn't fire.

View 4 Replies

C# - Button's OnClick Event Doesn't Fire

Nov 28, 2010

The following code is my ASP.NET page :

<MdsMenu:MenuItem Text="Button" Href="#">
<asp:Button ID="Button1" runat="server" Text="Button 01" OnClick="Button_Click" />
<asp:Button ID="Button2" runat="server" Text="Button 02" OnClick="Button_Click" />
</MdsMenu:MenuItem>

I don't know why Button_Click event doesn't fire!

protected void Button_Click(object sender, EventArgs e)
{
Button senderButton = sender as Button;
Label1.Text = senderButton.ID.ToString();
}

MdsMenu:MenuItem is my custom WebControl. If I insert a Button control out of MdsMenu:MenuItem tag it works well but if I inserted it within MdsMenu:MenuItem tag it doesn't fire the concerned method. What's wrong with my code?

Edit:
Menu.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Permissions;
using System.Collections;
using System.ComponentModel.Design;
using System.Drawing.Design;
using System.Web.UI.HtmlControls;
using System.IO;
namespace MenuServerControl
{
[AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[DefaultProperty("MenuItems")]
[ParseChildren(true, "MenuItems")]
[ToolboxData("<{0}:Menu runat="server"> </{0}:Menu>")]
public class Menu : WebControl
{
#region Fields
private List<MenuItem> _MenuItems;
string _Direction
{
get
{
string direction = "";
switch (this.Direction)
{
case Directions.LeftToRight:
direction = "direction:ltr;";
break;
case Directions.RightToLeft:
direction = "direction:rtl;";
break;
default:
direction = "direction:rtl;";
break;
}
return direction;
}
}
string _AnimationDelay
{
get
{
if (AnimationDelay == null)
AnimationDelay = 1000;
return AnimationDelay.ToString().ToLower();
}
}
string _AnimationType
{
get
{
switch (this.AnimationType)
{
case AnimationType.Opacity_Height:
return "animation:{opacity:'show',height:'show'}";
case AnimationType.Opacity_Width:
return "animation:{opacity:'show',width:'show'}";
case AnimationType.Opacity:
return "animation:{opacity:'show'}";
case AnimationType.Height:
return "animation:{height:'show'}";
case AnimationType.Width:
return "animation:{width:'show'}";
case AnimationType.Height_Toggle:
return "animation: {height: 'toggle'}";
case AnimationType.Width_Toggle:
return "animation: {width: 'toggle'}";
default:
return "animation:{opacity:'show',height:'show'}";
}
}
}
string _AnimationSpeed
{
get
{
switch (this.AnimationSpeed)
{
case AnimationSpeed.Fast:
return "speed:'fast'";
case AnimationSpeed.Normal:
return "speed:'normal'";
case AnimationSpeed.Slow:
return "speed:'slow'";
default:
return "speed:'fast'";
}
}
}
string FloatStyle
{
get
{
if (Direction == Directions.RightToLeft)
return "float:right;";
else return "";
}
}
string _Main_ul_CssClass = "";
#endregion
#region Properties
public string Main_ul_CssClass
{
get
{
if (string.IsNullOrEmpty(_Main_ul_CssClass)) return "";
_Main_ul_CssClass = "class=" + _Main_ul_CssClass;
return _Main_ul_CssClass;
}
set
{
_Main_ul_CssClass = value.Trim();
}
}
public Directions Direction { get; set; }
public int? AnimationDelay { get; set; }
public AnimationType AnimationType { get; set; }
public AnimationSpeed AnimationSpeed { get; set; }
public bool DropShadow { get; set; }
public bool AutoArrows { get; set; }
[Category("Behavior")]
[Description("The menu collection")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public List<MenuItem> MenuItems
{
get
{
if (_MenuItems == null)
_MenuItems = new List<MenuItem>();
return _MenuItems;
}
}
public VerOrHor VerticalOrHorizontal { get; set; }
#endregion
#region Methods
public Menu()
{
DropShadow = true;
AutoArrows = true;
}
public override void RenderBeginTag(HtmlTextWriter writer)
{
writer.Write("<div id="" + this.ID + "" style="" + _Direction + " " + FloatStyle + "">");
}
public override void RenderEndTag(HtmlTextWriter writer)
{
writer.Write("</div>");
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
#region Adding Script & link Tags
HtmlGenericControl jquery = new HtmlGenericControl("script");
jquery.Attributes.Add("type", "text/javascript");
jquery.Attributes.Add("src", Page.ClientScript.GetWebResourceUrl(typeof(MenuServerControl.Menu), "MenuServerControl.JavaScriptFiles.jquery_1_4_3.js"));
jquery.EnableViewState = false;
Page.Header.Controls.Add(jquery);
HtmlGenericControl hoverIntent = new HtmlGenericControl("script");
hoverIntent.Attributes.Add("type", "text/javascript");
hoverIntent.Attributes.Add("src", Page.ClientScript.GetWebResourceUrl(typeof(Menu), "MenuServerControl.JavaScriptFiles.hoverIntent.js"));
hoverIntent.EnableViewState = false;
Page.Header.Controls.Add(hoverIntent);
HtmlGenericControl jquery_bgiframe_min = new HtmlGenericControl("script");
jquery_bgiframe_min.Attributes.Add("type", "text/javascript");
jquery_bgiframe_min.Attributes.Add("src", Page.ClientScript.GetWebResourceUrl(typeof(Menu), "MenuServerControl.JavaScriptFiles.jquery_bgiframe_min.js"));
jquery_bgiframe_min.EnableViewState = false;
Page.Header.Controls.Add(jquery_bgiframe_min);
HtmlGenericControl superfish = new HtmlGenericControl("script");
superfish.Attributes.Add("type", "text/javascript");
superfish.Attributes.Add("src", Page.ClientScript.GetWebResourceUrl(typeof(Menu), "MenuServerControl.JavaScriptFiles.superfish.js"));
superfish.EnableViewState = false;
Page.Header.Controls.Add(superfish);
HtmlGenericControl supersubs = new HtmlGenericControl("script");
supersubs.Attributes.Add("type", "text/javascript");
supersubs.Attributes.Add("src", Page.ClientScript.GetWebResourceUrl(typeof(Menu), "MenuServerControl.JavaScriptFiles.supersubs.js"));
supersubs.EnableViewState = false;
Page.Header.Controls.Add(supersubs);
if (Direction == Directions.LeftToRight)
{
HtmlGenericControl csslink = new HtmlGenericControl("link");
csslink.Attributes.Add("href", Page.ClientScript.GetWebResourceUrl
(typeof(Menu), "MenuServerControl.CSS.superfish.css"));
csslink.ID = "NavigationMenu";
csslink.Attributes.Add("type", "text/css");
csslink.Attributes.Add("rel", "stylesheet");
csslink.EnableViewState = false;
Page.Header.Controls.Add(csslink);
}
else
{
HtmlGenericControl csslink = new HtmlGenericControl("link");
csslink.Attributes.Add("href", Page.ClientScript.GetWebResourceUrl
(typeof(Menu), "MenuServerControl.CSS.RightToLeft superfish.css"));
csslink.ID = "NavigationMenu";
csslink.Attributes.Add("type", "text/css");
csslink.Attributes.Add("rel", "stylesheet");
csslink.EnableViewState = false;
Page.Header.Controls.Add(csslink);
}
if (this.VerticalOrHorizontal == VerOrHor.Vertical && this.Direction == Directions.RightToLeft)
{
HtmlGenericControl csslink01 = new HtmlGenericControl("link");
csslink01.Attributes.Add("href", Page.ClientScript.GetWebResourceUrl
(typeof(Menu), "MenuServerControl.CSS.RightToLeft superfish-vertical.css"));
csslink01.Attributes.Add("type", "text/css");
csslink01.Attributes.Add("rel", "stylesheet");
csslink01.EnableViewState = false;
Page.Header.Controls.Add(csslink01);
}
else if (this.VerticalOrHorizontal == VerOrHor.Vertical)
{
HtmlGenericControl csslink01 = new HtmlGenericControl("link");
csslink01.Attributes.Add("href", Page.ClientScript.GetWebResourceUrl
(typeof(Menu), "MenuServerControl.CSS.superfish-vertical.css"));
csslink01.Attributes.Add("type", "text/css");
csslink01.Attributes.Add("rel", "stylesheet");
csslink01.EnableViewState = false;
Page.Header.Controls.Add(csslink01);
}
#endregion
}
protected override void RenderContents(HtmlTextWriter output)
{
output.Write(CreateMenuHtmlTags());
}
StringBuilder CreateMenuHtmlTags()
{
if (this._MenuItems == null)
throw new Exception("تگ های مربوط به منو را کامل کنید");
StringBuilder Html = new StringBuilder("");
#region Add <Script>
if (String.IsNullOrEmpty(Main_ul_CssClass))
Html.Append("<script>$(document).ready(function() { $("ul.sf-menu").superfish({pathLevels: 1,");
else
Html.Append("<script>$(document).ready(function() { $("ul." + Main_ul_CssClass + "").superfish({ pathLevels: 1,");
Html.Append("delay:" + _AnimationDelay + ",");
Html.Append(_AnimationType + ",");
Html.Append(_AnimationSpeed + ",");
Html.Append("dropShadows: " + DropShadow.ToString().ToLower() + ",");
Html.Append(@"autoArrows: " + AutoArrows.ToString().ToLower() + "});});</script>");
#endregion
if (string.IsNullOrEmpty(Main_ul_CssClass) && VerticalOrHorizontal == VerOrHor.Vertical)
Html.Append("<ul class="sf-menu sf-vertical sf-js-enabled sf-shadow" id='sample-menu-1'>");
else if (String.IsNullOrEmpty(Main_ul_CssClass))
Html.Append("<ul class="sf-menu sf-js-enabled sf-shadow" id='sample-menu-1'>");
else
Html.Append("<ul class="" + Main_ul_CssClass + "" id='sample-menu-1'>");
foreach (MenuItem item in _MenuItems)
{
if (item == null) continue;
if (item.SubMenuItems != null && item.SubMenuItems.Count > 0)
{
Html.Append("<li" + item.li_CssClass + ">");
Html.Append("<a href="" + item.Href + "">" + item.Text.Trim() + "</a>");
ParseSubMenuItems(ref Html, item);
Html.Append("</li>");
}
else if (item.SubMenuItems != null)
Html.Append("<li" + item.li_CssClass + "><a href="" + item.Href + "">" + item.Text.Trim() + "</a></li>");
}
Html.Append("</ul>");
return Html;
}
void ParseSubMenuItems(ref StringBuilder Html, MenuItem menuItems)
{
if (menuItems == null) return;
Html.Append("<ul " + menuItems.ul_CssClass + " style="display: none; visibility: hidden;">");
foreach (var item in menuItems.SubMenuItems)
{
if (item == null) continue;
MenuItem Sub_MenuItem = item as MenuItem;
WebControl webControl = item as WebControl;
if (Sub_MenuItem != null)
{
if (Sub_MenuItem.SubMenuItems != null && Sub_MenuItem.SubMenuItems.Count > 0)
{
Html.Append("<li" + Sub_MenuItem.li_CssClass + ">");
Html.Append("<a href="" + Sub_MenuItem.Href + "">" + Sub_MenuItem.Text.Trim() + "</a>");
ParseSubMenuItems(ref Html, Sub_MenuItem);
Html.Append("</li>");
}
else if (Sub_MenuItem.SubMenuItems != null)
Html.Append("<li" + Sub_MenuItem.li_CssClass + "><a href="" + Sub_MenuItem.Href + "">" + Sub_MenuItem.Text.Trim() + "</a></li>");
}
else if (webControl != null)
{
Html.Append("<li>");
webControl.EnableViewState = true;
this.Controls.Add(webControl);
webControl.EnableViewState = true;
StringBuilder sb = new StringBuilder();
sb.Append("<div>");
using (StringWriter sw = new StringWriter(sb))
{
using (HtmlTextWriter textWriter = new HtmlTextWriter(sw))
{
webControl.RenderControl(textWriter);
}
}
sb.Append("</div>");
Html.Append(sb.ToString());
Html.Append("</li>");
}
}
Html.Append("</ul>");
}
#endregion
}
}
MenuItem.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
namespace MenuServerControl
{
[DefaultProperty("SubMenuItems")]
[ParseChildren(true, "SubMenuItems")]
[TypeConverter(typeof(ExpandableObjectConverter))]
public class MenuItem : INamingContainer
{
#region Fields
ArrayList _SubMenuItems;
string text = "";
string href = "#";
string _ul_CssClass = "";
string _li_CssClass = "";
#endregion
#region Properties
[Description("متن منو آیتم")]
[DefaultValue("")]
[NotifyParentProperty(true)]
public string Text
{
get
{
return text;
}
set
{
text = value;
}
}
[DefaultValue("#")]
[Description("<a /> href attribute")]
[NotifyParentProperty(true)]
public string Href
{
get
{
return href;
}
set
{
href = value;
}
}
[DefaultValue("")]
[Description("<ul /> css class")]
[NotifyParentProperty(true)]
public string ul_CssClass
{
get
{
if (string.IsNullOrEmpty(_ul_CssClass)) return "";
_ul_CssClass = " class="" + _ul_CssClass + """;
return _ul_CssClass;
}
set { this._ul_CssClass = value.Trim(); }
}
[DefaultValue("")]
[Description("<li /> css class")]
[NotifyParentProperty(true)]
public string li_CssClass
{
get
{
if (string.IsNullOrEmpty(_li_CssClass)) return "";
_li_CssClass = " class="" + _li_CssClass + """;
return _li_CssClass;
}
set { this._li_CssClass = value.Trim(); }
}
[Category("Behavior")]
[Description("The MenuItems collection")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public ArrayList SubMenuItems
{
get
{
if (_SubMenuItems == null)
_SubMenuItems = new ArrayList();
return _SubMenuItems;
}
}
#endregion
}
}

You can download the project from here.

View 1 Replies

C# - Button Event Handlers Do Not Fire On The First Click But On The Second Click After A PostBack

May 4, 2010

Background: I am customizing an existing ASP .NET / C# application. It has it's own little "framework" and conventions for developers to follow when extending/customizing its functionality. I am currently extending some of it's administrative functionality, to which the framework provides a contract to enforce implementation of the GetAdministrationInterface() method, which returns System.Web.UI.Control. This method is called during the Page_Load() method of the page hosting the GUI interface.

Problem: I have three buttons in my GUI, each of which have been assigned an Event Handler. My administration GUI loads up perfectly fine, but clicking any of the buttons doesn't do what I expect them to do. However, when I click them a second time, the buttons work.

I placed breakpoints at the beginning of each event handler method and stepped through my code. On the first click, none of the event handlers were triggered. On the second click, they fired.

Example of Button Definition (within GetAdministrationInterface)

[Code]....

View 2 Replies

Web Forms :: Click Event Doesn't Fire In Ascx Control Nested In Masterpage

Jan 23, 2011

I don't understand because the click event doesn't fire in ascx control nested in masterpage.

The scenario is:

In Page Pre-Init i load a particular MasterPage, one of these have a ascx control with LogOff Button.

The ascx is showed correctly but doesn't fire the button click event that allow me to logoff.

I haven't load the control programmatically but directly in masterpage:

[Code]....

[Code]....

View 4 Replies

Dropdown Selected Change Event Fire On Button Click Event?

Sep 24, 2010

I have write the code in .Net. When I click the Buttun then fired below event.

protected void ddldesignation_SelectedIndexChanged(object sender, EventArgs e)
{
Code.
}

View 1 Replies

AJAX :: ModalPopUp Cancel Button Event Doesn't Fire?

Feb 2, 2010

I have a modalpopup that i have opening on a radiobutton selection. That works great, opens when it should and closes when you click cancel. BUT i have the following on my cancel button event that is not firing

[Code]....

I also have a button event for my "OK" button and that works great, but my cancel event doesnt seem to fire or work. Maybe the ClearSelection() is not what i need..

I want to clear the radiobutton if they cancel out of the ModalPopUp so they can make a new selection, since its a required field.

View 2 Replies

Having To Click A Button Twice To Fire Event?

Oct 15, 2010

I have a Web Form that contains a Web Control. This control has several buttons on it and one in particular requires that I click it twice before the Click Event fires. The settings are all the same for the buttons but just not sure what to look for.

View 7 Replies

Button Click Event Fire Only On Second Click?

Sep 14, 2010

In ASP.NET My button click event doesn`t work on first click. But it works on the second click only.

View 1 Replies

Web Forms :: Programmatically Created Event Handler For A Button Doesn't Fire Up?

Mar 21, 2010

I'm trying to manually create a button and add a Click event handler for it in code. However when the button is clicked the event handler doesn't seem to react on event (or event isn't called).

we tested the code in Visual Studio 2008 and everything worked just as it should. And I'm using Visual Web Developer 2005 XE. So I assume that I'm missing something to be done manually being in VWD 2005 XE, or the problem is in VWD 2005 XE it self.

here is what I'm doing:

[Code]....

View 9 Replies

User Control Command Button Event Doesn't Fire The First Time?

Jan 23, 2011

I am fairly new to the asp.net and experimenting with it to learn the page life cycle. Here is a problem that I have been unable to resolve for past few days.

I have a hosting page (.aspx). Then I have two user controls (.ascx). The page has a place holder control in which it loads the user controls one at a time based on the application flow. First user control is loaded on application start up. It has a "continue" button. Continue button click loads the Second user control that has two buttons - "Back" and "Submit". Obviously the "Back" button should load the first user control again and Submit button should submit the form data. Pretty simple.

The problem is that the command button event handler that I have on the second user control is not firing the first time. (I have one event handler for both buttons). The load event of the user control fires but then it ignores the button click. If I click it again, then it fires. I re-load the controls on the page in every page_load. Here is some relevent code:

AddPlayer.aspx:

[Code]....

The page_Load fires every time but "CommandBtn_Click" doesn't fire after the first click. I have to do it click it again. It doesn't matter which order I click the buttons.

View 1 Replies

Web Forms :: Button Click Event Does Not Fire?

Jan 30, 2011

i have a problem with my dynamic button.

This is my scriptcode, i would like to create a dynamic Listbox and a dynamic button. But after click on this button, the event in addressOf btnListEinfuegen_Click is doing nothing. It does not run.

[Code]....

what ist wrong in my script? Why does my button not fire?

View 15 Replies

Web Forms :: Event Seem To Fire When Click The Button?

Jun 20, 2010

Am I doing someting wrong,my event only seem to fire when I click the button,but the text-box does not cause a postback.

[Code...]

View 15 Replies

Web Forms :: User Control Command Button Event Doesn't Fire The First Time

Jan 19, 2011

I am fairly new to the asp.net and experimenting with it to learn the page life cycle. Here is a problem that I have been unable to resolve for past few days.I have a hosting page (.aspx). Then I have two user controls (.ascx). The page has a place holder control in which it loads the user controls one at a time based on the application flow. First user control is loaded on application start up. It has a "continue" button. Continue button click loads the Second user control that has two buttons - "Back" and "Submit". Obviously the "Back" button should load the first user control again and Submit button should submit the form data.

View 3 Replies

Web Forms :: Button Posts Back But Doesn't Fire Event Only In IIS - Fine In Cassini

Nov 29, 2010

Here's an odd one that I've never seen before. Only on IIS, not in Cassini but in all web browsers I have a button that posts back and the page_load event fires, but the actual button click event doesn't fire. there is no re-writing of the page or anything else happening.

View 4 Replies

Unable To Get Dynamic Button Click Event To Fire

Jul 28, 2010

I am adding some dynamic image buttons to a form in my code behind (vb.net) and added a click event handler, but it never fires. Also when I click on a button the page posts back and everything below my update panel disappears.

code behind

[Code]....

Click handler

[Code]....

Here is my aspx page code.

[Code]....

View 5 Replies

C# - Click Event Of A Button To Fire Fileupload Control

Jan 12, 2011

I have a fileupload Control and I made this as invisible. I want to fire browse button of that fileupload control when I clicked a nother button.How can I do?

View 1 Replies

C# - How To Fire A Button Click Event When Enter Key Is Pressed

Jul 14, 2010

I have a form with several submit buttons. I would like the button's click events to fire when enter is pressed based on which textboxes currently have focus. I am able to specify one button using the code below by adding the onkeydown event to the body of the page and checking for Enter's keyCode

<body onkeydown="if(event.keyCode==13){document.getElementById('btnSearch').click();}">
</body>

I assume this code can be modified or call a function to perform a conditional to see if txtSearch or txtSubmit has focus and specify btnSearch or btnSubmit accordingly, but I am not experienced with javascript.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved