Results 1 to 4 of 4

Thread: How to create a table like VBF? (RESOLVED)

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    How to create a table like VBF? (RESOLVED)

    I have a table, Feedback.
    I would like to display this data like VBF displays it's threads...In a grid thing.

    I am sick of seeing code, but having no idea what to do with it, or where to place it in my code?

    Can anyone help me?

    I crash course of style sheets would be good.

    Woof

  2. #2
    Addicted Member rdove's Avatar
    Join Date
    Dec 2002
    Location
    Indianapolis
    Posts
    251
    You could bind it to the datagrid control. The control already has styles and such much like the design of VBF built in. Just use the auto format. It works rather well for displaying data and its really easy to use.
    ~Ryan





    Have I helped you? Please Rate my posts.

  3. #3
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: How to create a table like VBF?

    Originally posted by Wokawidget
    I have a table, Feedback.
    I would like to display this data like VBF displays it's threads...In a grid thing.

    I am sick of seeing code, but having no idea what to do with it, or where to place it in my code?

    Can anyone help me?

    I crash course of style sheets would be good.

    Woof
    Woka, you could either use DataGrid or DataRepeater control. DataRepeater is more flexible if you wish to construck output with embeded tables.

    It is simple to use.

    First get your data into a DataSet and set the datasource property of the DataRepeater to dataset. Assuming you placed a Repeater Control called rpPost in the form. The following would go in the Page Load.


    Code:
    rpPost.DataSource=ds;
    			rpPost.DataMember="Post";
    			rpPost.DataBind();
    Now the HTML for the page. You need to define three sections :

    1. Header (e.g the table header, Here we open table)
    2. Item Template (any code here gets looped, so in effect this is a loop)
    3. Footer (any footer text, here we close the table)

    Here is an example i stripped down from my ASP.Net forum

    Hope this helps.

    VB Code:
    1. <BODY>
    2.         <center>
    3.             <h1 align="center"><% Response.Write(Thread_Title);%></h1>
    4.             <form id="thread" method="post" runat="server">
    5.                 <asp:repeater id="rpPost" runat="server">
    6.                     <HeaderTemplate>
    7.                         <table bgcolor="LightBlue" width="90%" cellpadding="5" cellspacing="1">
    8.                             <tr>
    9.                                 <td class="tableborder">Author</td>
    10.                                 <td class="tableborder"><b><% Response.Write (Thread_Title); %></b></td>
    11.                             </tr>
    12.                     </HeaderTemplate>
    13.                     <ItemTemplate>
    14.                         <tr bgcolor="white">
    15.                             <td width="20%" valign="top">
    16.                                 <b>
    17.                                     <%
    18.                                 string s;
    19.                                 s="<a href='GetUser.aspx?UserId=" + ds.Tables["Post"].Rows[i]["UserId"].ToString() + "'>" + ds.Tables["Post"].Rows[i]["Username"].ToString() + "</a>";
    20.                                
    21.                                 Response.Write (s);
    22.                                 %>
    23.                                     <br>
    24.                                 </b>
    25.                             </td>
    26.                             <td bgcolor="White">
    27.                                 <b>
    28.                                     <%# DataBinder.Eval(Container.DataItem, "PostTitle") %>
    29.                                 </b>
    30.                             </td>
    31.                         </tr>
    32.                         <tr>
    33.                             <td class="tableborder"><%# DataBinder.Eval(Container.DataItem, "Time_Created") %></td>
    34.                             <td class="tableborder" align="right">
    35.                                 <table border="0">
    36.                                     <tr>
    37.                                         <td align="right"><a href='DeletePost.aspx?PostId=<%# DataBinder.Eval(Container.DataItem, "PostId") %>'>Delete</a></td>
    38.                                         <td align="right"><a href='reply.aspx?ThreadId=<%# DataBinder.Eval(Container.DataItem, "ThreadId")%>&PostId=<%# DataBinder.Eval(Container.DataItem, "PostId")%>'>Quote</a></td>
    39.                                     </tr>
    40.                                 </table>
    41.                             </td>
    42.                         </tr>
    43.                         <%
    44.                             i++;
    45.                         %>
    46.                     </ItemTemplate>
    47.                     <FooterTemplate>
    48.                         <tr>
    49.                             <td class="tableborder" colspan="2" align="right">
    50.                                 <%
    51.                                 string lnk;
    52.                                 lnk="JavaScript:window.location='reply.aspx?ThreadId=" + threadid + "';" ;
    53.                                 %>
    54.                                 <input type="button" value="Reply" class="bttn" onclick="<% Response.Write(lnk);%>">
    55.                             </td>
    56.                         </tr>
    57.                         </table>
    58.                     </FooterTemplate>
    59.                 </asp:repeater>
    60.         </center>
    61.         </FORM>
    62.     </BODY>
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  4. #4

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    I have used an XSL file, a CSS file and an ASP XML Control on my page.

    This I have found is WAY easier than using a datalist, or another control. Well, I think so anyways.
    I have also been told that this is a much better way of doing it...would this be right? I can see how it would be.

    Woka

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width