By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,230 Members | 2,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,230 IT Pros & Developers. It's quick & easy.

Attaching JavaScript To ASP.Net Controls

P: n/a
Hello, I was wondering how I would go about attaching some Java script code
to a <asp:EditCommandColumn. If the user presses the "edit" link, then I
want to test other controls to see if any information has been keyed into
them.

Is there a way to do that?

How do I reference other controls in my JavaScript?

Thanks in advance for your assistance!!!!!!!!!
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Jim,

Attach javascript to your control in the code-behind page:

MyButton.Attributes.Add("onClick", "javascript: return
myJavascriptFunction();")

Reference other controls by their client id's

document.Form1.button1

If you're building your javascript in the code-behind page and then
registering it with Page.RegisterClientScriptBlock then you can get a
control's client id via its ClientId property: Button1.ClientId
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Jim Heavey" <Ji*******@nospam.com> wrote in message
news:Xn*********************************@207.46.24 8.16...
Hello, I was wondering how I would go about attaching some Java script code to a <asp:EditCommandColumn. If the user presses the "edit" link, then I
want to test other controls to see if any information has been keyed into
them.

Is there a way to do that?

How do I reference other controls in my JavaScript?

Thanks in advance for your assistance!!!!!!!!!

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.