How can I hide a repeater in ASP.NET C# if the DataSource contains no items?

前端 未结 9 1937
小鲜肉
小鲜肉 2021-01-02 17:29

I have an ASP.NET page that uses a repeater nested within another repeater to generate a listing of data. It\'s to the effect of the following:



        
9条回答
  •  南笙
    南笙 (楼主)
    2021-01-02 18:13

    I know this is an old thread and the answer above is a very nice solution, but I had a similar problem and have found another vary simple solution I thought I would share also. This validates just fine and displays the same.

    Just change your footer template to:

     
                
  • This will not show.

Or if your using tables:

 
             style="display:none;">But something must be in here. 
 

Hope that helps someone!

提交回复
热议问题