|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Why does Gridview ALWAYS emit style="border-collapse: collapse;"table tag with a style attribute containing "border-collapse: collapse". I have tried everything that I can think of to remove this style, but without results. I have tried the following: Attributes.CssStyle.Remove(HtmlTextWriterStyle.BorderCollapse); Attributes.CssStyle.Clear() I have attempted this from the RenderContents(), OnInit(), and OnPreRender() methods. The problem is that even in the RenderContents() method, the Attributes.CssStyle.Count properties is 0. So it seems that the Border-Collapse style is not added until a later point in the control's lifecycle. Any thoughts on this? It seems to be really improper for the Gridview to inject this style into HTML. I really need to control the control's style through a CssClass. -- Tom Castiglia tom.castig***@gmail.com tcastig***@hersheytech.com Hi Tom,
It's incorrectly hardcoded in ASP.NET in some places. Try this? GridView1.GridLines = GridLines.None GridView1.CellSpacing=-1 Note that you'll still get border="0" Nothing can be done about that til there's an update. Let us know if this helps? Ken Microsoft MVP [ASP.NET] Show quoteHide quote "Tom Castiglia" <tom.castiglia@no-gmail-spam.com> wrote in message news:39CB7C23-50F7-48F3-BD74-3F1A24CC77D3@microsoft.com... >I am inheriting from the GridView and I noticed the GridView ALWAYS emits >its > table tag with a style attribute containing "border-collapse: collapse". > I > have tried everything that I can think of to remove this style, but > without > results. > > I have tried the following: > > Attributes.CssStyle.Remove(HtmlTextWriterStyle.BorderCollapse); > Attributes.CssStyle.Clear() > > I have attempted this from the RenderContents(), OnInit(), and > OnPreRender() > methods. The problem is that even in the RenderContents() method, the > Attributes.CssStyle.Count properties is 0. So it seems that the > Border-Collapse style is not added until a later point in the control's > lifecycle. > > Any thoughts on this? It seems to be really improper for the Gridview to > inject this style into HTML. I really need to control the control's style > through a CssClass. > > -- > Tom Castiglia > tom.castig***@gmail.com > tcastig***@hersheytech.com Ken,
Thank you...That worked! Can you also figure out how to get me back the 10 hours I spent working on this problem? Tom Castiglia Hershey Technologies Show quoteHide quote "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in message news:OrnsNFeiGHA.1600@TK2MSFTNGP04.phx.gbl... > Hi Tom, > > It's incorrectly hardcoded in ASP.NET in some places. > > Try this? > > GridView1.GridLines = GridLines.None > GridView1.CellSpacing=-1 > > Note that you'll still get > > border="0" > > Nothing can be done about that til there's an update. > > Let us know if this helps? > > > Ken > Microsoft MVP [ASP.NET] > > > "Tom Castiglia" <tom.castiglia@no-gmail-spam.com> wrote in message > news:39CB7C23-50F7-48F3-BD74-3F1A24CC77D3@microsoft.com... >>I am inheriting from the GridView and I noticed the GridView ALWAYS emits >>its >> table tag with a style attribute containing "border-collapse: collapse". >> I >> have tried everything that I can think of to remove this style, but >> without >> results. >> >> I have tried the following: >> >> Attributes.CssStyle.Remove(HtmlTextWriterStyle.BorderCollapse); >> Attributes.CssStyle.Clear() >> >> I have attempted this from the RenderContents(), OnInit(), and >> OnPreRender() >> methods. The problem is that even in the RenderContents() method, the >> Attributes.CssStyle.Count properties is 0. So it seems that the >> Border-Collapse style is not added until a later point in the control's >> lifecycle. >> >> Any thoughts on this? It seems to be really improper for the Gridview to >> inject this style into HTML. I really need to control the control's >> style >> through a CssClass. >> >> -- >> Tom Castiglia >> tom.castig***@gmail.com >> tcastig***@hersheytech.com > > I'm having a very similar problem with the Login control - again it always generates a default style containing 'border-collapse' - only in this case the control doesn't appear to have a GridLines or CellSpacing attribute - how can I change the style in this case?
Regards,
Steve
--- Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
prevent runat="server"
MediaPlayer WebControl problem What do validation controls do, internally, on server side to stop to page processing from continuin add default row to DropDownList Hyperlink control NavigationUrl problem Template RadioButton change web.config programmatically button click event problem menu control will not expand (2.0) how to execute the DeleteCommand in code-behind? |
|||||||||||||||||||||||