开发者

Hide AutoGenerateRows from a User Control?

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 t开发者_StackOverflow中文版o 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;
                }
            }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜