1

I have looked at the code in both the following posts:

  1. formatting in razor nested webgrid, replied to by nemesv in October 2011 and

  2. Razor Nested WebGrid, replied to by Chad Moran in April 2011.

They both seem to be close to my problem but the code is C# based, I believe, and I am having difficulty converting it to VB. I am also not sure they are exactly where I am at. I am particularly bemused by the following line, because of the two equals signs and double reference to subGrid.

WebGrid subGrid = subGrid = new WebGrid(item.SubItems)

I am also not sure whether topGrid and subGrid are just generic names, used for the purpose of illustration, or whether they are key words.

As a very relevant aside I will mention that this point in my web page project has held me up for five years now (I am not exaggerating - I just stopped working on the project for two years because of it). I have tried using ASP in VWD and now Grid View in WebMatrix and I hope I will not fail again.

Database record

Fields: Publisher_Name, Publisher_City, Series_Published, No_of_Series

Record Example: Price Stern Sloan, Baltimore, JKLMNO, 6

My two planned grid names

Publishers_Grid (top) Series_Grid (sub)

What I am trying to do

  1. For each of the characters in the string JKLMNO, access a second table, where each letter is the primary key for a record in that table.

  2. Retrieve the value of the field, Back_Cover_Image, in that second table, which will be the file name or, at least, the unique part of the file name, for the image to be displayed.

  3. If I go with the partial unique bit of file name approach, build the full file names for the images. And then -

  4. Display as a second web grid row, the images thus pointed at, in the record example, that would be 6 images.

Thus I would end up, for the example record, something like the following (I have used XX to stand for an image): -

Price Stern Sloan    Baltimore    XX  XX  XX  XX  XX  XX

I certainly I hope I am not wasting the valuable time of experts who I greatly admire. I'm just trying to achieve something that seems quite simple to me, having originally been a PL/1 programmer, 30 years ago, and a great user of nested arrays within that language, but I just can't work out the syntax in VB, Razor and WebMatrix.

I look forward to some constructive answers, and please do use VB.

My WebMatrix page so far

@Code

    Layout = "~/Shared/Layouts/_Layout.vbhtml"

     Dim HWB_Database As Database = Database.Open("How_and_Why_Wonder_Books")
     Dim HWB_Publishers_All_sqlCommand = "SELECT * FROM Publishers ORDER BY Publisher_Code"
     Dim Publishers_Data = HWB_Database.Query(HWB_Publishers_All_sqlCommand)
     Dim Publishers_Grid = New WebGrid(Publishers_Data)

End Code

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>How and Why Wonder Books - Publishers</title>
    </head>
    <body>
        <div style="margin-left: 100px">
         <p  style="Width: 1020px; border-width: 1px" class="InstructionsHeader">
          Click on a publisher to see the list of titles produced under that imprint, click on a thumbnail to see details of that series type.
         </p>
        </div>
     <br>               
     <br>               
        <div id="Publishers_Grid_Display">
         @Publishers_Grid.GetHtml(columns:= Publishers_Grid.Columns(
                                                                     Publishers_Grid.Column("Publisher_Name"),
                                                         Publishers_Grid.Column("Place_of_Publication"),
                                                      Publishers_Grid.Column("Series_Published")
                                                      )
        )
        </div>

Thank you for your promptings and encouragement.

Community
  • 1
  • 1
  • Please show the code you have so far. Also please link to the questions you are talking about. Saying `replied to by nemesv in October 2011` and `replied to by Chad Moran in April 2011` means nothing when you have millions of questions on StackOverflow. – Darin Dimitrov Dec 31 '12 at 10:03
  • Please tell me how to create such links - I wanted to actually post this as a follow up to one of those previous questions, like I would on a Microsoft forum, but I couldn't find a way of doing so. – Philip Mark Hunt Dec 31 '12 at 10:35
  • There's no such notion as follow-up question on StackOverflow. As far as creating a link is concerned, you should use the hyperlink icon when typing text. Also read the [`Markdown tips`](http://stackoverflow.com/editing-help) - orange question mark button to better understand the different formats that you could use when typing text. More specifically there's a paragraph called [`Links`](http://stackoverflow.com/editing-help#links). – Darin Dimitrov Dec 31 '12 at 10:42
  • I just added the code, as requested. I tried to follow the instructions re putting the links in, but it doesn't seem to be working. Please feel free to edit them so they work properly, and so I learn what mistake I have made. I see the text, of what I have tried to do, when I edit the post. – Philip Mark Hunt Dec 31 '12 at 11:07
  • What isn't working? I hope you don't take this the wrong way, but you never actually said what the problem is. – Clay Compton Jan 02 '13 at 23:02
  • Dear Clay Publishers_Grid.Column("Series_Published") produces the string out of Series_Published. What I am wanting is an inner grid of JPEGS as pointed at by each letter of the string Series_Published, so as per the example data I don't want the string JKLMNO( which is what I've got now), but rather a row of JPEGs as pointed at by J, K, L, M, N, O, each letter being the primary key to a record in the Series table where there is a field Image_Name. This is what I set out under the heading "What I am trying to do", in the original post. Thank you for taking an interest. – Philip Mark Hunt Jan 03 '13 at 10:26

0 Answers0