c# - Loop through dynamic radio buttons if it check status Y/N -


I need advice ...

I have a form, in which the number of consumer panels The usercontrol has the generated radio buttons on runtime) (Structure of the Wifera)

I have seen this thread:

Prices are assigned from the MySQL database, Against this radio button will have to be checked. Also the names of the radio are assigned by loop: from:

  "radio button 1" + [i]. Ostring (); From   

:

  "radio button 4" + [i]. ostring (); For example:  I have 10 groups of 4 Radiobuton I (40 Radio) Should I save my states in the array? In this way [0,0,0,1,1,0,0,0,0,0,0,0 ..., ...] I should have a chance to test it against the database.  

I appreciate some simple solution for this.

In my recommendation winform panels will be for loops on each panel, get usercontrol. Then, loop on each control in user control. If the control is a radiobutan, then check it against the database. I'm not sure how you're matching the radio button to the database, but probably matches the text attribute of the radio button.

Psuedocode:

 Wifi control panel in configuration. Control: // Panel check what the panel is: // Get user control from the panel. UserControl usrCtrl = panel.usercontrol UserControl foreach as control control in usrCtrl.Controls: // check type control is radio button: // database stuff   

edit: I would recommend setting the tag attribute of your radio boots when specifying the values ​​from the database. The tag attribute may be whatever you want it to be. For example, you can set tags on YourTableName.YourColumnName . In this way you can track what radio button corresponds to which area.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -