I have a User Control with a DetailsView that has the property AutoGenerateRows set to 'true'. My pages (asp.net and c# code), use a SQLDataSource for its data. Typically I want all rows to show up in my WebForm, however, occasionally I want to be able to hide specific ones. Is there any way to do this or do I have to hardcode every row I want and set autogeneraterows to false?
Help is appreciated! Thanks everyone!
Try this After Binding
foreach (DetailsViewRow Row in MyDetailsView1.Rows)
{
if (Your Condition..)
{
Row.Visible = false;
}
}
you could do this for checking your value:
foreach (DetailsViewRow Row in MyDetailsView1.Rows)
{
if (Row.Cells[index of your column].Text=="")
{
Row.Visible = false;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.