DataGrid Problem still after 2 days. Help me

Discussion in 'ASP.NET / ASP.NET Core' started by 27lamps, Jan 26, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hello,

    i am trying to create a DataGrid with:
    1. No Heading and No Footer
    2. With Custom next and previous text
    3. With all items text using the "smallGreyText" .css style
    4. With no lines, borders or anything like that

    Anyway, until now i am not able to apply the .css and i also get some lines around and beetween the items. Please help me because i don't know what else to change or try.

    Thank You,
    Miguel

    The code i have now is this:

    </table>
    <table width="265" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><form runat="server">
    <asp:DataGrid id="dataGridFaq"
    runat="server"
    CssClass="smallGreyText"
    AllowSorting="false"
    AutoGenerateColumns="false"
    CellPadding="0"
    CellSpacing="0"
    ShowFooter="false"
    ShowHeader="false"
    DataSource="<%# dataSetFaq.DefaultView %>"
    PagerStyle-Mode="NextPrev"
    AllowPaging="true"
    AllowCustomPaging="true"
    PageSize="<%# dataSetFaq.PageSize %>"
    VirtualItemCount="<%# dataSetFaq.RecordCount %>"
    OnPageIndexChanged="dataSetFaq.OnDataGridPageIndexChanged"
    >
    <HeaderStyle BackColor="white" BorderWidth="0" CssClass="smallGreyText" />
    <ItemStyle BackColor="white" BorderWidth="0" CssClass="smallGreyText" />
    <AlternatingItemStyle BackColor="white" BorderWidth="0" CssClass="smallGreyText" />
    <FooterStyle BackColor="white" BorderWidth="0" CssClass="smallGreyText" />
    <PagerStyle BackColor="white" BorderWidth="0" CssClass="smallGreyText" />
    <Columns>
    <asp:HyperLinkColumn
    HeaderText="Question"
    Visible="True"
    DataTextField="Question"
    DataNavigateUrlField="FaqID"
    DataNavigateUrlFormatString="faq-detail.aspx?Link={0}"/>
    </Columns>
    </asp:DataGrid>
    </form></td>
    </tr>
    </table>

    Cheers,
    Miguel

    .web: http://www.27lamps.com
    .email: [email protected]
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    I am not too good w/ datagrid.

    I would check out this site, http://datagridgirl.com/

    quote:Originally posted by 27lamps

    Hello,

    i am trying to create a DataGrid with:
    1. No Heading and No Footer
    2. With Custom next and previous text
    3. With all items text using the "smallGreyText" .css style
    4. With no lines, borders or anything like that

    Anyway, until now i am not able to apply the .css and i also get some lines around and beetween the items. Please help me because i don't know what else to change or try.

    Thank You,
    Miguel

    The code i have now is this:

    </table>
    <table width="265" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><form runat="server">
    <asp:DataGrid id="dataGridFaq"
    runat="server"
    CssClass="smallGreyText"
    AllowSorting="false"
    AutoGenerateColumns="false"
    CellPadding="0"
    CellSpacing="0"
    ShowFooter="false"
    ShowHeader="false"
    DataSource="<%# dataSetFaq.DefaultView %>"
    PagerStyle-Mode="NextPrev"
    AllowPaging="true"
    AllowCustomPaging="true"
    PageSize="<%# dataSetFaq.PageSize %>"
    VirtualItemCount="<%# dataSetFaq.RecordCount %>"
    OnPageIndexChanged="dataSetFaq.OnDataGridPageIndexChanged"
    >
    <HeaderStyle BackColor="white" BorderWidth="0" CssClass="smallGreyText" />
    <ItemStyle BackColor="white" BorderWidth="0" CssClass="smallGreyText" />
    <AlternatingItemStyle BackColor="white" BorderWidth="0" CssClass="smallGreyText" />
    <FooterStyle BackColor="white" BorderWidth="0" CssClass="smallGreyText" />
    <PagerStyle BackColor="white" BorderWidth="0" CssClass="smallGreyText" />
    <Columns>
    <asp:HyperLinkColumn
    HeaderText="Question"
    Visible="True"
    DataTextField="Question"
    DataNavigateUrlField="FaqID"
    DataNavigateUrlFormatString="faq-detail.aspx?Link={0}"/>
    </Columns>
    </asp:DataGrid>
    </form></td>
    </tr>
    </table>

    Cheers,
    Miguel

    .web: http://www.27lamps.com
    .email: [email protected]
    </blockquote id="quote"></font id="quote">
     
  3. here is a copy of a piece of my datagrid
    I had this problem too. You cant apply the style in the actual <Asp:datagrid tag. You have to apply your style to each element. like this:
    <Columns>
    <asp:BoundColumn DataField="username" ItemStyle-cssClass="tiny"/>
    <asp:BoundColumn DataField="topic" HeaderText="topic" HeaderStyle-CssClass="tiny" ItemStyle-CssClass="tiny"/>
    </Columns>

    Hope that helps. If it doesnt work for you then just use a datarepeater.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page