SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software

Development Forums for Programmer, Administrators and Users

Development resources, articles, tutorials, code samples and tools and downloads for ASP.Net, SQL Server, R Script, Windows, Windows Phone, AWS, SAP HANA and ABAP, like SAP UI5, Screen Personas, etc.

linkbutton and formfields problem

Last post 05-26-2011, 1:57 AM by vobtester. 0 replies.
Sort Posts:
  •  05-26-2011, 1:57 AM 22403

    linkbutton and formfields problem

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

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

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
       
    <title></title>
    </head>
    <body>
       
    <form id="form1" runat="server" defaultbutton="SignInLink">
       
    <div>
       
           
    <asp:TextBox ID="TextBox1" runat="server" Text="textbox"></asp:TextBox>
           
    <br />
           
    <br />
           
    <br />
           
    <input type="text" id="uname" name="username" onfocus="if(this.value=='formfield')this.value=''" value="formfield" class="formFields" tabindex="1" />
           
    <asp:Button ID="Button1" runat="server" Text="Button" />

           
    <asp:LinkButton ID="SignInLink" runat=server CssClass="fontRed"  
                       
    onclick="SignInLink_Click" OnClientClick="setVarHidden()"><strong>LinkButton </strong></asp:LinkButton>
       
        &nbsp;
    </div>
       
    </form>
    </body>
    </html>

    CODE BEHIND:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public partial class _Default : System.Web.UI.Page
    {
       
    protected void Page_Load(object sender, EventArgs e)
       
    {
           
    if (!IsPostBack)
           
    {
               
    TextBox1.Attributes.Add("onKeyPress", "doClick('" + SignInLink.ClientID + "',event)");
           
    }
       
    }
       
    protected void SignInLink_Click(object sender, EventArgs e)
       
    {

       
    }
     
    }

    when I'm inside formfield and press enter it does not go to: SignInLink_Click() . to make it work I have to click the LinkButton.

    How can I make it work by just pressing enter key in the formfield to activate the SignInLink_Click() (LinkButton) in firefox?


View as RSS news feed in XML
Copyright © 2004 - 2019 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems