开发者

Hide AutoGenerateRows from a User Control?

开发者 https://www.devze.com 2023-03-20 15:12 出处:网络
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

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

精彩评论

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