Denying the Enter button on a dynamic textbox located within a viewgrid cell

Posted on 2012-08-29
Last Modified: 2012-08-29
Hi I have a gridview,

I am constructing dynamic textboxes within the top row of cells in the gridview to create a search criteria row.

I have no problem accessing or dealing with the textbox controls to capture and react to data inputs.

I would like to add to the text box property  a JScript instruction to the client event -  onkeydown = "return (event.keyCode!=13);

In the Gridview HTML this can be set to a non dynamic control, whoever how do I add it to a dynamically created textbox control
Question by:DCM-Dave
    LVL 18

    Accepted Solution

    On dynamic created textbox obj Add this,
    dynamicTxtboxObj.Attributes.Add("onkeydown","return (event.keyCode!=13)");

    Open in new window


    Author Closing Comment

    Thanks for the help works perfectly :)

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now