c# - how to changed the checkbox to string in gridview -
i've column in datatable value true or false when fetched database. shows check box when displayed in gridview. want show the "yes" if value true , "no" if value false. how can that??
datatable dt = dbaction.executequery(command,zzz.id); if (dt != null && dt.rows.count > 0) { // want change here gridtaghistory.datasource =dt; this.showdialog(); }
you can modify select query (most recommended)
or
you can loop on datatable/gridview
foreach (datarow rw in dt.rows) { string = rw["yourboolcolname"].tostring(); if(a=="true") { rw["yourboolcolname"]="yes"; } else {rw["yourboolcolname"]="no";} } foreach (gridviewrow row in gridview1.rows) { label mylabel = (label)row.findcontrol("mylabelname"); if(mylabel.text=="true") { mylabel.text="yes"; } else if(mylabel.text=="false") { mylabel.text="no"; } }
Comments
Post a Comment