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

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

问题描述

在 ASP.NET Gridviews 中生成一个表,该表生成一个父 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然后 htmltext 在 prerender 事件中写出你新渲染的 html,或者让用户或自定义控件来执行此操作.

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天全站免登陆