c# - How to tell if the control or control interface is editable by the user? -


i'm looping through array of controls , need know controls end-user has ability (via javascript or directly) change value gets posted back. can find such list?

so far have this:

private function iseditablecontrol(byval control control) boolean     return typeof control ieditabletextcontrol _      orelse typeof control icheckboxcontrol _      orelse gettype(listcontrol).isassignablefrom(control.gettype()) _      orelse gettype(hiddenfield).isassignablefrom(control.gettype()) end function 

i'm rather sure need know if control implements ipostbackdatahandler.

public shared function iscontroleditable(byval ctrl control) boolean     return typeof ctrl ipostbackdatahandler end function 

"if want server control design examine form data posted server client, must implement ipostbackdatahandler interface. contract interface defines allows server control determine whether state should altered result of post back, , raise appropriate events."

these classes implement it:

  • checkbox
  • checkboxlist
  • dropdownlist
  • htmlinputcheckbox
  • htmlinputfile
  • htmlinputhidden
  • htmlinputimage
  • htmlinputradiobutton
  • htmlinputtext
  • htmlselect
  • htmltextarea
  • imagebutton
  • listbox
  • radiobuttonlist
  • textbox

the big advantage of checking implementing ipostbackdatahandler function works in future(with controls added framework) , third party controls.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -