locked
Table Creation| Html | Code Behind RRS feed

  • Question

  • User-1546380551 posted

    Hi,

    My question is a combination of VB.Net creating html code

    -----------------

    No Google links to pointless areticles in languages that are not VB.NET, please. If you cannot code it yourself, please don't reply because it's so annoying to ask a question then get pointless, timewasting links  just so you can get your points score up.

    -----------------

    Rant over - here goes:

    I have a table which has 3 columns - nothing special just simple but its's the row number I am having issues with. Will explain soon.

    There is a directory with jpg files in it and the number of jpg files increased yesterday by 67, today by 37. Because the picture files come with any filename I have created a Windows app that renames the new files taking the ending point of yesterdays number as the starting point for today

    So, each row holds 3 jpg files therefore 67 jpg / 3 = rows (yesterday). First number today is 68. I type 68 into the app I created, enumberating & moving (renaming) the jpg ('hduyhdgu.jpg becomes 68.jpg, suhdos.jpg becomes 69.jpg and so on for each of the new jpgs in that directory. That is done by the simple FileInfo/DirectoryInfo classes. Whilst renaming the photos in numerical sequence it has to write the html in the following form:

    <td>

         <td><asp:Image ID="Image67" runat="server" ImageUrl="/67.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image68" runat="server" ImageUrl="/68.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image69" runat="server" ImageUrl="/69.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

    </td>

    <td>

         <td><asp:Image ID="Image70" runat="server" ImageUrl="/70.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image71" runat="server" ImageUrl="/71.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image72" runat="server" ImageUrl="/72.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

    </td>

    and so on.

    The problem I am facing is the start number can be anything meaning this yesterday:

    <td>

         <td><asp:Image ID="Image67" runat="server" ImageUrl="/67.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image68" runat="server" ImageUrl="" CssClass="" AlternateText="" /></td>

         <td><asp:Image ID="Image69" runat="server" ImageUrl="" CssClass="" AlternateText="" /></td>

    </td>

    Instead of starting the program from 68 to write the code for the other two cells on the same row I will start it on the next row (70.jpg)& write those two rows in manually for now (one minue job)

    So, if I use 70 as the starting point for today, I wish for it to follow on but it doesn't. This is what it does:

    <td>

         <td><asp:Image ID="Image70" runat="server" ImageUrl="/70.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image71" runat="server" ImageUrl="/71.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image72" runat="server" ImageUrl="/72.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

    </td>

    <td>

         <td><asp:Image ID="Image71" runat="server" ImageUrl="/71.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image72" runat="server" ImageUrl="/72.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image73" runat="server" ImageUrl="/73.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

    </td>

    from now on they are perfect follow on:

    <td>

         <td><asp:Image ID="Image74" runat="server" ImageUrl="/74.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image75" runat="server" ImageUrl="/75.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image76" runat="server" ImageUrl="/76.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

    </td>

    <td>

         <td><asp:Image ID="Image77" runat="server" ImageUrl="/77.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image78" runat="server" ImageUrl="/78.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

         <td><asp:Image ID="Image79" runat="server" ImageUrl="/79.jpg" CssClass="[some class]" AlternateText="[same alt text]" /></td>

    </td>

    and so on. I then just copy to clipboard and paste in manually, saving making the new content immediately live.

    I say:

    Dim i As Integer = CInt(txtStartNumber.Text)

    If i Mod 3 = 0 Then CreateRows(i) ' Sub to create the html table row.

    ...

    Of course as I have demonstrated above it sorts it'self out sequencially but the groups of 3 images now belong on 2 different lines and not the 1 like it shoud be

    My Questions are:

    1) How to sort out the row numbers so they flow in groups of 3 correctly and not 70, 71, 72, 71, 72, 73, 74, 75..?

    2) How to create the table in code that dynamically draws itself with 3 columns (200px each done by CSS) wide and enough rown to hold every jpg in that directory? So, if I moved 5000 jpgs in that directory tomorrow the code will loop through and create the html.

    3) If creating the table dynamically as in Q2 above how would I fix the place to draw it? Placeholder? A div is easy (<div 'id="MyTable" runat="server"></div>. In code behind: MyTable.InnerText=.../MyTable.InnerHtml=...) but is it the best idea?

    Dim iFiles As Integer = IO.DirectoryInfo.GetFiles([MyVirtualDirectory], "*.jpg").Count

    Dim intRows As Integer = iFiles / 3

    Lastly, it has to be SEO/Google Bot, Yapoo Bot compatible so the search engines can access & index the page and follow the links

    Thanks in advance

    Thursday, July 21, 2011 10:36 PM

All replies

  • User-1546380551 posted

    Hello Raigad,

    Sorry but this is not what I asked for exactly. I was asking for code not Google links, and the main question was the row/cell number creating the html markup which you ignored. This is why I asked for an answer from someone who can code it and not search Google for a pointless link.

    It seems no-one in these forums ever writes code in the language you ask it for but just searches Google with a few keywords. They need to close these forums down & replace it with a Google Custom Search control or as it's Microsoft, Bing.

    Back to the original question. If someone knows how to do this in VB.NET ONLY, please can they let me know

    Ex:

    If i MOD 3 = 0 Then...

    Everything is in the original post

    Friday, July 22, 2011 2:34 PM
  • User-1694870838 posted

    Hi,

    could you please give us your behind code so that we can help you as soon as possible.

    I think you can display all your images Fully automatic,maybe it will be better if you display the images using girdview control.

    Best Regards,

    Dmaon

    Wednesday, July 27, 2011 4:51 AM