Raise an event from server side control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone tell me how to raise an event or trap when the maxlength of a
server side textbox has been reached?
 
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/
 
Thanks a lot. You've been a big help.

Alex Homer said:
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/
 
if you set a the 'MaxLength' for a text it will not allow you to type text
longer than the 'MaxLength'

HTH

Ollie Riches
 
use RegisterClientScriptBlock:

RegisterClientScriptBlock("clientScript", "<script
language=JavaScript>alert('Hello ');</script>");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top