Google Answers Logo
View Question
 
Q: ASP.NET & Client Side Scripts with Bound CheckBoxLists ( No Answer,   1 Comment )
Question  
Subject: ASP.NET & Client Side Scripts with Bound CheckBoxLists
Category: Computers > Programming
Asked by: sneakyfcasni-ga
List Price: $13.00
Posted: 26 May 2004 14:17 PDT
Expires: 08 Jun 2004 21:39 PDT
Question ID: 352359
Using a DATABOUND Checkboxlist we would like to be able to have a
clientside VB Script that pops up a message box whenever a certain
check box (with a certain value) is checked.  When checking any of the
other checkboxes in the bound list..  nothing will happen.

Remember:  
This is using ASP.NET
The CheckBoxList Control is databound to a database.
The MessageBox must only popup when certain checkboxes (with a certain
value) are checked.
This must be VBScript on the CLIENTSIDE.
Answer  
There is no answer at this time.

Comments  
Subject: Re: ASP.NET & Client Side Scripts with Bound CheckBoxLists
From: aa7im-ga on 04 Jun 2004 02:35 PDT
 
Actually for this scenario it would be easier to just use
"asp:checkbox" and manually add them to a placeholder somewhere on the
page.  Just loop through the data and for each row create a new
checkbox (with onclick event) and add it to the place holder. 
Something like:

[C#]
foreach(DataRow row in dt)
{
  CheckBox ck = new CheckBox;
  ck.Text = row["Name"].ToString();
  if(row["EmployeeType"] == 1) 'Add OnClick event only for employees
where employeetype = 1)
  {
    ck.Atrributes["onClick"] = "alert('Hello');";
  }

  checkBoxPlaceHolder.Controls.Add(ck); 'Put checkbox on page
}

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy