Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 20th, 2012  |  syntax: None  |  size: 0.46 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Find textBox, checkBox, any object by name C#
  2. void checking(int input)
  3. {
  4.     CheckBox checkbox = (CheckBox)this.Controls["checkBox" + input.toString()];
  5.     if(checkbox.isChecked)
  6.       //do something here
  7. }
  8.        
  9. void checking(int input)
  10. {
  11.     CheckBox checkbox = (CheckBox)this.FindControl("checkBox" + input.toString());
  12.     if(checkbox.isChecked)
  13.       //do something here
  14. }
  15.        
  16. CheckBox checkbox = (CheckBox)this.Controls.Find("checkBox" + input.toString())[0];