Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 493
  • Last Modified:

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

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
1 Solution
Rajar AhmedConsultantCommented:
On dynamic created textbox obj Add this,
dynamicTxtboxObj.Attributes.Add("onkeydown","return (event.keyCode!=13)");

Open in new window

DCM-DaveAuthor Commented:
Thanks for the help works perfectly :)

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now