Asp.net allows you to add to the pages of various complex elements like gridview, etc., which, when opened, are transformed into a set of HTML tags.

How to write elements in CSS (like gridview)? Need to open the code of this element and based on it to write selectors CSS? Or you can not rely on it and in different browsers gridview can unfold in different sets of HTML tags? How to act in such cases in asp.net?

    2 answers 2

    And what prevents to indicate to your elements the css-class?

    <asp:GridView CssClass="class_name" /> 

    GridView in ASP.NET is rendered in an HTML table in any browser. Respectively, and in style specify selectors for the table.

    • Clear. Thank. I just wanted to make sure that you can really do this, i.e. that there will not be a situation when the same asp.net element will be rendered into different sets of HTML elements in different browsers. - shc345

    Here is a live example:

      /*GridView ------------------------------------------------------------------------------------------------------------*/ .GridViewSt { font-family: Arial, Sans-Serif; font-size: small; table-layout: auto; border-collapse: collapse; } .PagerSt table { text-align: center; margin: auto; } .PagerSt table td { border: 0px; padding: 5px; } .PagerSt td { border-top: #fff 1px solid; } .PagerSt a { color: #000; text-decoration: none; padding: 2px 10px 2px 10px; border-top: solid 1px #fff; border-right: solid 1px #91a7b4; border-bottom: solid 1px #91a7b4; border-left: solid 1px #fff; background-color: #FFE4B5; } .PagerSt span { font-weight: bold; color: #000000; text-decoration: none; padding: 2px 10px 2px 10px; border-top: solid 1px #91a7b4; border-right: solid 1px #fff; border-bottom: solid 1px #fff; border-left: solid 1px #91a7b4; background-color: #fff; } <asp:GridView ID="gvCoffee" runat="server" AutoGenerateColumns="False" AllowPaging="True" PageIndex="0" CellPadding="10" ShowHeader="False" PageSize="4" CssClass="GridViewCoffee" PagerStyle-CssClass="PagerCoffee">