Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
ASP.NET 1.0/1.1
CREARE DINAMICAMENTE UN CHECKBOXLIST
giovedì 30 marzo 2006 - 14.24
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
gandalf_03_75
Profilo
| Junior Member
68
messaggi | Data Invio:
gio 30 mar 2006 - 14:24
CIAO RAGAZZI STO CERCANDO DI CREARE UN CHECKBOXLIST A RUNTIME MA NN CI RIESCO.
ALLORA ESEGUO UNA QUAERY SUL DB E MI CARICO QUINDI HO UN DATASET CONTENENTE LE SEGUENTI INFO:
- ID
- NOME
- DESCRIZIONE
DOVREI CREARE TANCTI CHECKBOX NEL CHECBOXLIST QUANTI SONO I RECORD PRESENTI NEL DATASET.
POTRESTE DARMI UNA MANO??
GRAZIE MILLE
Per i paurosi il futuro resterà sconosciuto, per i deboli sarà irraggiungibile, per gli incoscienti offrirà nuove opportunità.
fedecheller
Profilo
| Junior Member
129
messaggi | Data Invio:
gio 30 mar 2006 - 14:53
Inserisci tutto un oggetto table:
TableRow tr;
TableCell tc;
CheckBox chk;
DataSet ds = "il tuo dataset";
if(ds!=null){
for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
tr = new TableRow();
tc = new TableCell();
chk = new CheckBox();
chk.ID = ds.Tables[0].Rows[i]["mioid"];
chk.Text = ds.Tables[0].Rows[i]["miadescrizione"];
tc.Controls.Add(chk);
tr.Cells.Add(tc);
tbl.Rows.Add(tr);
}
}
oppure assegni il dataset al datasource della checkboxlist e poi fai il Databind():
CheckBoxList1.DataSource = ds;
CheckBoxList1.DataValueField = "id";
CheckBoxList1.DataTextField = "descrizione";
CheckBoxList1.DataBind();
MUSIC IS FREE, DRINK ARE TO PAY, STAY TILL LATE BUT SLEEP AWAY
gandalf_03_75
Profilo
| Junior Member
68
messaggi | Data Invio:
gio 30 mar 2006 - 15:50
GRAZIE MILLE SEI STATO VERAMENTE GENTILE
SPERO UN GIORNO DI POTER RICAMBIARE.
TANKSSSSSSSSSSSSSSSSSSSSSSSSSSS
Per i paurosi il futuro resterà sconosciuto, per i deboli sarà irraggiungibile, per gli incoscienti offrirà nuove opportunità.
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !