Well I finally figured out a way to do this. I couldn't get the
document.getElementById thing to work, and I'm sure there must be a
more concise way to do this (for example, passing an array) but I don't
know Javascript well enough. At this point, I don't care. I got it to
work, so I'm supplying the complete solution for the other poor souls
out there trying to do the same thing. As a reminder, what this does
is, when the user clicks the asp:RadioButton whose ASP ID is
rbtnS0start, I want the client to run Javascript in the .aspx page so
that the asp:RadioButtons named rbtnS1start thru rbtnS6start
automatically get checked.
In the code-behind page I have this code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
rbtnS0start.Attributes.Add("OnClick", "rbtnS0start_Click("
+
rbtnS1start.ClientID + "," +
rbtnS2start.ClientID + "," +
rbtnS3start.ClientID + "," +
rbtnS4start.ClientID + "," +
rbtnS5start.ClientID + "," +
rbtnS6start.ClientID +
");");
}
}
In the .aspx page, I included the following code just before the
</asp:Contenttag (which is the last tag on the page)...
<script type="text/javascript">
function rbtnS0start_Click(b1,b2,b3,b4,b5,b6)
{
b1.checked = true;
b2.checked = true;
b3.checked = true;
b4.checked = true;
b5.checked = true;
b6.checked = true;
}
</script>
Could this have possibly been made any harder to do!!??
On Jan 26, 9:29 am, "Barry" <dys...@gmail.comwrote:
Ok, now I want to work with my client controls (instead of just popping
up an alert). For instance when they click rbtnS0start I want the
javascript on the client to set rbtnS1start (another asp:RadioButton)
to be 'checked=true'. I've tried things like: rbtnS1start.Checked =
true; but apparently that's not right because it doesn't check the
button or execute the rest of my javascript.
Obviously I'm quite new to client-side scripting, so any help/pointers
you can provide would be most appreciated. (Btw, I'm on the clock, so
the sooner someone will help me the better.)
Thank you!!
On Jan 25, 1:17 pm, "Barry" <dys...@gmail.comwrote:
Oh what a difference a couple of curly braces make! Imagine 9 hours
wasted because I didn't have the curly braces :-(. Thank you both very
much!!
On Jan 24, 8:14 pm, "Mark Rae" <m...@markNOSPAMrae.comwrote:
"bruce barker" <nos...@nospam.comwrote in messagenews:%2****************@TK2MSFTNGP05.phx.gb l...
you need to legal javascript syntax to define the function.
<script type="javascript">Or even
<script type="text/javascript">
if you want to be XHTML-compliant...- Hide quoted text -- Show quoted text -- Hide quoted text -- Show quoted text -