如何摆脱包含一个GridView空的div [英] How to rid of empty div that contains a GridView
问题描述
在ASP.NET GridView的生成,其生成父股利容器的表。这可以打破CSS布局,因为没有办法样式附加到所生成的格。有没有一种方法,以prevent从生成格或将样式应用到它的方法吗?
In ASP.NET Gridviews generate a table which generates a parent div container. This can break CSS layouts since there is no way to attach styles to the generated div. Is there a way to prevent the div from generating or a way to apply a style to it?
这被要求并标记为解决<一个href=\"http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=104139\">here但MS刚才说是需要的分页和排序功能分区。难道我明白,如果我想使用分页和排序功能,我不能完成我自己的div周围和应用样式?谢谢
This was asked and marked as resolved here but MS just said that the div is needed for the Paging and Sorting functionality. Am I to understand that if I want to use the paging and sorting functionality I can't wrap my own div around it and apply a style? Thanks
推荐答案
我从来没有这样做,但我我的第一个猜想是,你可以抢渲染HTML输出它到达浏览器之前,去掉外层div然后htmltextwrite您的新呈现的HTML在prerender事件或使用户或自定义控件做到这一点。
I've never done this, but I my first guess would be you could grab the rendered html output just before it gets to the browser, remove the outer div and then htmltextwrite out your new rendered html in the prerender event or make a user or custom control to do this.
不过,你铤而走险GridView控件的功能,但如果你知道你会不会使用了采用DIV功能来,那么你可能逃脱它。
But then you risk breaking the functionality of the gridview but if you know you won't be using the features that use the div, then you might get away with it.
这篇关于如何摆脱包含一个GridView空的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!