Trucos de C# Crear checkbox dinamicos
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
Pon el truco en tus favoritos
Trucos relacionados de Crear checkbox dinamicos
-
-
-
-
-
-
-
Truco de C#, Como remover etiquetas HTML
Para eliminar las etiquetas de HTML en un texto, podemos utilizar un algoritmo complejo donde quietemos todos los tags, pero también, podemos utilizar las fenomenales regulars expressions: