well i'm dynamically generating my web controls on a page. so what ever table
comes in as the datasource the application will generate the webcontrols for
the fields (no controls exist on the designer).
my problem is well what if i want to attach javascript events to a
particular webcontrol what would we the best way to handle that?
You can emit the required client script into the page with any of the various
Page.ClientScript methods, whichever is appropriate. Wnen creating your
dynamic controls, you can add the OnClientClick attribute to the control to
set up the event. Or, use the Attributes.Add method to do same.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
well i'm dynamically generating my web controls on a page. so what ever table
comes in as the datasource the application will generate the webcontrols for
the fields (no controls exist on the designer).
my problem is well what if i want to attach javascript events to a
particular webcontrol what would we the best way to handle that?
When the controls load they can dynamically write their own
javascripts and associate client-side events with those methods. Look
at the Page.RegisterClientScriptBlock method.
regards
A.G.
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.