I use the trick of creating the client-side function call in ASP.NET in the
ItemDataBound event for each row of a grid, and passing the ID of the
control to the function so it can be located in the client-side script.
You'll have to include the grid control ID as well as the textbox control ID
in the correct combination ("parentID_textboxID").
There's a heap of samples at:
http://www.daveandal.net/books/6744/samples.aspx
that do similar stuff. The Using a Client-side Confirmation Dialog one binds
a client-side event to every button in a Datagrid, and the various User
Control and Server Control examples do the same kind of thing with a number
of parameters passed to the client-side code to locate controls in the page
in the client-side code. You can download all the samples from:
http://www.daveandal.net/books/6744/
"Tim Westmoreland" <Ti*************@discussions.microsoft.com> wrote in
message news:D6**********************************@microsof t.com...
What if the textbox is in an editable datagrid and you don't know what the
id is?
"Alex Homer" wrote:
You need to use client-side script to handle the onkeydown, keypress or
onkeyup events. Here's an exmple that handles the events and displays
the key codes - should work on all modern browsers:
http://www.daveandal.net/books/6744/...-mappings.aspx
This example uses the keycodes to create a masked edit control, showing
how you can managet he content of the text box:
http://www.daveandal.net/books/6744/.../maskedit.aspx
"Tim Westmoreland" <Tim We**********@discussions.microsoft.com> wrote in
message news:E6**********************************@microsof t.com... Can someone tell me how to raise an event or trap when the maxlength
of a server side textbox has been reached?