如何清除包含GridView的空div [英] How to rid of empty div that contains a GridView

查看:128
本文介绍了如何清除包含GridView的空div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ASP.NET中,Gridview生成一个生成父div容器的表。这可以打破CSS布局,因为没有办法附加样式到生成的div。有没有办法防止div生成或一种方式来应用一种风格呢?

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?

系统询问此问题并将其标记为已解决这里,但MS只是说,div是分页和排序功能所需的。我要明白,如果我想使用分页和排序功能,我不能包装我自己的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆