VB, Access DB, Custom table layout, and datagrid?

Discussion in 'Databases' started by WVMClub, May 25, 2006.

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

    I'm new to .NET, but I've have some experience using Classic ASP with VB Script and ADO connectivity. I managed to build a rather complex web site that was essentially self-maintaining. However, I wanted more control, more power, and more customization options, and felt that the upgrade to ASP .NET 2.0 would give me what I need.

    So far, it's been great, as has the service here at DiscountASP.com.

    I'm running into some problems that i didn't expect to be so difficult given my prior experience.

    I have an Access database that I'm using. I can connect to it and retrieve information in the GridView, Datalist, etc controls, but I need to build a custom table where I can place one field from each record in a different cell. Each table would be a new record.

    Example:
    <table> <!-- information from record 1 -->
    <tr colspan=2>
    <td><!-- display title here --></td>
    </tr>
    <tr>
    <td><!-- display event date here --></td>
    <td rowspan=2><!-- display picture here -->
    </tr>
    <tr>
    <td><!-- display event details here --></td>
    </tr>
    </table>


    <table> <!-- information from record2 -->
    <tr colspan=2>
    <td><!-- display title here --></td>
    </tr>
    <tr>
    <td><!-- display event date here --></td>
    <td rowspan=2><!-- display picture here -->
    </tr>
    <tr>
    <td><!-- display event details here --></td>
    </tr>
    </table>

    That is an over-simplification, but it expresses what I'm trying to do.

    Can someone offer advice as to what the best way would be to connect to the database and display the records in the above format?

    I found that I can connect using the Classic ASP code by using the @page aspcompat=true, but I want to take full advantage of ASP .NET 2.0.

    Please help.

    Thanks

    Jerad
     
  2. Try using DataGrid...it's a powerfulyet useful obj....


    Just pop your image using its TemplateColumn....





    This is what it can do...see demo on my company site..


    click here


    http://www.maxtop.ca/product.aspx

    Hope, it helps[​IMG]

    J. L.
    Technical Support/IT Admin/MIS Developer
    Maxtop Enterprises Inc.
    http://www.maxtop.ca</CODE>
     
  3. J.Bey,


    Thanks for the quick reply.


    Unfortunately, the example at your site is what I can do already.


    What I need to do is format each record into it's own table, not it's own row of the table.


    Maybe if I explained the specific portion of the web site that I am working on.


    I am the webmaster for a Mustang Club website. One table I maintain is a calendar of events. These events are categorized based upon event type (i.e., Car Show, Cruise-in, Club Activity, Club Meeting, Mustang Monday, Community Activity, etc.) The fields in the table are eventTypeID, eventDate, eventStartTime, eventEndTime, eventRegistrationStart, eventRegistrationEnd, eventHost, eventDetails, eventRegistrationFee, etc just to name a few.


    All of this information in one row is too big. Hence, I need a table for each row.


    I want it to look like http://www.wabashvalleymustangclub.org/example.aspx, where all words or cells in yellow are pulled from the database.


    Still possible with GridView?
     
  4. In my experience, I have found it's a good idea not to be afraid of the Repeater control. Repeater is a control (like the GridView) but it's more simple, and basically leaves all the formatting up to you.

    A simple example of what you're trying to do might be:

     
  5. Ok, I'm back.

    Sorry for my n00b ignorance. I learn best through doing, through trial and error, and learning stuff as I need it.

    How do I insert VB code to check conditions of these variables?

    Example:
     
  6. Whenever I need to do something more complicated I usually just call a function.

    Anything inside the Repeater has to be in <%# %> brackets and anything inside those brackets has to evaluate to a value. That means it can't be a lot of logic and if/then statements.

    So in your case, I'd do something like this. In the Repeater put a call to a function:

     
  7. By doing that, you might run into /Application error

    Try use a DataTable or DataView object to store the variables and then use the data field name in your select statement instead...

    Hope it helps


     
  8. that definitely rings a bell[​IMG]

    J. L.
    Technical Support/IT Admin/MIS Developer
    Maxtop Enterprises Inc.
    http://www.maxtop.ca</CODE>
     
  9. It definitely sounds like a step in the right direction. Like I said, I'm new to .NET and I'm still learning what all of the built-in controls do.

    I'm going to look into the Repeater to learn its syntax and usage. I'll check back in as I progress.

    Thanks.

    Jerad
     
  10. Long time since I've really had a chance to work on this. Unfortunately, I haven't made much headwayinto my problem.


    In Classic ASP, my pseudo-code was:


    Open database.


    Read recordset into memory and call it RS.


    Check the value of the field in the current recordset called "FirstField".


    If RS("FirstField").value = 1 then


    if SecondField value is not blank, then


    display (or Print) NextField


    end if


    if thirdField is not blank then


    if display ThirdField in Date Format WeekDayName, Month Day


    end if


    end if


    end if


    RS.movenext





    Like I said, psuedo-code - part legit, part bad. But that's the general idea of what I'm trying to do here. I need to be able to check the value of the field for certain conditions. Is there a way of doing this without creating a separate function for each one?






    Post Edited (Wabash Valley Mustang Club) : 7/3/2006 7:17:29 PM GMT
     
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