Buscar en el sitio

Contacto

Danny

962318754

blackorwhite_dm@hotmail.com

Crear checkbox dinamicos

03.11.2010 19:33

Con esta función podrás crear checkbox de forma dinámica.


 


#region dyanamic checkboxes

//Function to generate the dyanamic checkboxes

 

private void AddCheckboxes(string strCheckboxText)

 

          {

 

                try

 

                {

 

                     if(PnlTimeExpence.HasControls())

 

                     {

 

                           return;

 

                     }

 

                     for(int intControlIndex=0;intControlIndex=5;intControlIndex++)

 

                     {

 

                           chkList1 =new CheckBox();

 

                           chkList1.Text = strCheckboxText;

 

                           chkList1.ID="Chk"+intControlIndex;

 

                           chkList1.Font.Name = "Verdana";

 

                           chkList1.Font.Size = 9;

 

                           PnlControl.Controls.Add(chkList1);

 

                           PnlControl.Controls.Add(new LiteralControl("<;br>;"));

 

                     }

 

                }

 

                catch(Exception exp)

 

                {

 

                     throw new Exception(exp.Message);

 

                }

 

          }

 

#endregion