Professional Web Applications Themes

Lost as can be - ASP.NET Data Grid Control

I am completely lost. I used a WebMatrix wizard and tried to make it a DataList. I get no errors but it doesn't work either. I really need help. Don't laugh too hard. I have been having a terrible time trying to figure this out. I just want to get this to bind and display properly in a tabular format. If it looks like I don't know very well what I'm doing then you'd be right. I've been up and down a lot of doentaion but I have just served to confuse myself more. I'm way on the wrong side ...

  1. #1

    Default Lost as can be

    I am completely lost. I used a WebMatrix wizard and tried to make it a
    DataList. I get no errors but it doesn't work either. I really need help.
    Don't laugh too hard. I have been having a terrible time trying to figure
    this out. I just want to get this to bind and display properly in a tabular
    format. If it looks like I don't know very well what I'm doing then you'd be
    right. I've been up and down a lot of doentaion but I have just served to
    confuse myself more. I'm way on the wrong side of 50. This is something I do
    for my family which is very large and spread all over the country. I have a
    page doing this in ASP and it works fine but ASP.NET has thrown me pretty
    good. If I could get on the right track once I hope I can figure it out from
    there. Make necessary corrections and post the results if it isn't too much
    trouble.

    <% Page Language="VB" debug="true" %>
    <% import Namespace="System.Data" %>
    <% import Namespace="System.Data.OleDB" %>
    <script runat="server">

    Sub Page_Load
    Dim dstNewFmnfo As System.Data.DataSet
    Dim connectionString As String =
    "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data
    Source=G:/websites/krausyr/fpdb/newfami"& _
    "nfo.mdb"
    Dim dbConnection As System.Data.IDbConnection = New
    System.Data.OleDb.OleDbConnection(connectionString )

    Dim queryString As String = "SELECT [Results].[SpouseName],
    [Results].[CellPhone], [Results].[MaritalStatus], "& _
    "[Results].[Child_Of], [Results].[ZIP], [Results].[City],
    [Results].[MiddleName],"& _
    " [Results].[HomePhone], [Results].[State], [Results].[LastName],
    [Results].[Work"& _
    "Phone], [Results].[DateofBirth], [Results].[StreetAddress],
    [Results].[Key], [Re"& _
    "sults].[FirstName], [Results].[EmailAddress], [Results].[ChildrenNames]
    FROM [Re"& _
    "sults]"
    Dim dbCommand As System.Data.IDbCommand = New
    System.Data.OleDb.OleDbCommand
    dbCommand.CommandText = queryString
    dbCommand.Connection = dbConnection

    Dim dataAdapter As System.Data.IDbDataAdapter = New
    System.Data.OleDb.OleDbDataAdapter
    dataAdapter.SelectCommand = dbCommand
    Dim dataSet As System.Data.DataSet = New System.Data.DataSet
    dataAdapter.Fill(dstNewFmnfo)

    dlstNewFmnfo.DataSource = dstNewFmnfo
    dlstNewFmnfo.DataBind()


    End Sub

    </script>
    <html>
    <head>
    <title>Datalist.aspx</title>


    </head>
    <body>
    <form Runat="server">
    <asp:DataList ID="dlstNewFmnfo" Runat="Server">

    <HeaderTemplate>
    <h2>Fam Mbr First Name:</h2>
    </HeaderTemplate>

    <ItemTemplate>
    <table>
    <tr>
    <td align="right">First Name:</td>
    <td><%# Container.DataItem( "FirstName" )%></td>
    </tr>
    </ItemTemplate>

    </asp:DataList>

    </form>
    </body>
    </html>


    Thanks for your help, John K.


    John K Guest

  2. #2

    Default Re: Lost as can be

    John,
    post a specific problem so we can help you. Nobody likes to troubleshoot a
    wild goose.

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    [url]http://tinyurl.com/27cok[/url]
    "John K" <john.krausprodigy.net> wrote in message
    news:ekCfW1YGEHA.1240TK2MSFTNGP10.phx.gbl...
    > I am completely lost. I used a WebMatrix wizard and tried to make it a
    > DataList. I get no errors but it doesn't work either. I really need help.
    > Don't laugh too hard. I have been having a terrible time trying to figure
    > this out. I just want to get this to bind and display properly in a
    tabular
    > format. If it looks like I don't know very well what I'm doing then you'd
    be
    > right. I've been up and down a lot of doentaion but I have just served
    to
    > confuse myself more. I'm way on the wrong side of 50. This is something I
    do
    > for my family which is very large and spread all over the country. I have
    a
    > page doing this in ASP and it works fine but ASP.NET has thrown me pretty
    > good. If I could get on the right track once I hope I can figure it out
    from
    > there. Make necessary corrections and post the results if it isn't too
    much
    > trouble.
    >
    > <% Page Language="VB" debug="true" %>
    > <% import Namespace="System.Data" %>
    > <% import Namespace="System.Data.OleDB" %>
    > <script runat="server">
    >
    > Sub Page_Load
    > Dim dstNewFmnfo As System.Data.DataSet
    > Dim connectionString As String =
    > "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data
    > Source=G:/websites/krausyr/fpdb/newfami"& _
    > "nfo.mdb"
    > Dim dbConnection As System.Data.IDbConnection = New
    > System.Data.OleDb.OleDbConnection(connectionString )
    >
    > Dim queryString As String = "SELECT [Results].[SpouseName],
    > [Results].[CellPhone], [Results].[MaritalStatus], "& _
    > "[Results].[Child_Of], [Results].[ZIP], [Results].[City],
    > [Results].[MiddleName],"& _
    > " [Results].[HomePhone], [Results].[State], [Results].[LastName],
    > [Results].[Work"& _
    > "Phone], [Results].[DateofBirth], [Results].[StreetAddress],
    > [Results].[Key], [Re"& _
    > "sults].[FirstName], [Results].[EmailAddress],
    [Results].[ChildrenNames]
    > FROM [Re"& _
    > "sults]"
    > Dim dbCommand As System.Data.IDbCommand = New
    > System.Data.OleDb.OleDbCommand
    > dbCommand.CommandText = queryString
    > dbCommand.Connection = dbConnection
    >
    > Dim dataAdapter As System.Data.IDbDataAdapter = New
    > System.Data.OleDb.OleDbDataAdapter
    > dataAdapter.SelectCommand = dbCommand
    > Dim dataSet As System.Data.DataSet = New System.Data.DataSet
    > dataAdapter.Fill(dstNewFmnfo)
    >
    > dlstNewFmnfo.DataSource = dstNewFmnfo
    > dlstNewFmnfo.DataBind()
    >
    >
    > End Sub
    >
    > </script>
    > <html>
    > <head>
    > <title>Datalist.aspx</title>
    >
    >
    > </head>
    > <body>
    > <form Runat="server">
    > <asp:DataList ID="dlstNewFmnfo" Runat="Server">
    >
    > <HeaderTemplate>
    > <h2>Fam Mbr First Name:</h2>
    > </HeaderTemplate>
    >
    > <ItemTemplate>
    > <table>
    > <tr>
    > <td align="right">First Name:</td>
    > <td><%# Container.DataItem( "FirstName" )%></td>
    > </tr>
    > </ItemTemplate>
    >
    > </asp:DataList>
    >
    > </form>
    > </body>
    > </html>
    >
    >
    > Thanks for your help, John K.
    >
    >

    Alvin Bruney [MVP] Guest

  3. #3

    Default Re: Lost as can be

    I started over from scratch because I found a link on the MS ASP.NET site
    that gave a complete example of a DataList using OleDB with Access. Just
    what I wanted to do. It represented the main structure and from there I was
    OK. I just wanted to make all the records appear in tabular form so users
    could scroll down and see each of the fields in each record. There are too
    many fields to use comfortably in that way with a DataGrid because you have
    to scroll horizontally and vertically (a pain in the butt). There are about
    150 records (family members) and some people like to scroll through them to
    refresh their memory about what kid belongs to whom etc. It takes six to
    eight seconds for this page to load but it isn't called that often. It's a
    little longer with dial up but still not too bad. Most people use the
    'Search' cause people typically look for a unique person. I have fields for
    spouse, parents, children, as well as addresses phone(s) and the like. We
    also have a lot of genealogy info dating back to the 1600s that one of my
    brothers has been compiling for years. That is in a different section of the
    site. We also have a section with a LOT of photos and members can upload
    photos.

    For my next trick I think I will make it so the records each display a
    picture of the person. We started planning a big family reunion last year
    for this summer and I'll be taking a photo of everyone with a digital
    camera. I don't know if Access can store pictures in JPG or if I will need
    to reference to a web folder that contains the images.

    I"ve had this site up and running for almost four years and decided to bite
    the bullet and change over to ASP.NET (from ASP). It's a lot of work and is
    challenging if you aren't a programmer. I originally had it all running on
    Server 2000 but my server was getting a bit long in the tooth so I built a
    new one last fall with Standard Server 2003. It works great!!

    Thanks Alvin. I'm sure I'll need help in the near future again.

    Later, John Kraus


    John K Guest

Similar Threads

  1. help I'm lost
    By getfothers in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: December 5th, 12:10 PM
  2. Lost CD
    By CodeBuster in forum Dreamweaver AppDev
    Replies: 0
    Last Post: March 5th, 09:12 AM
  3. lost of 8MB of RAM on my
    By Kiyan Zadeh in forum Mac Networking
    Replies: 3
    Last Post: September 21st, 08:57 PM
  4. I've lost it!
    By Katie Becker in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 13
    Last Post: August 15th, 03:37 AM
  5. lost in ASP & WSH!please help!
    By kyiu in forum ASP
    Replies: 1
    Last Post: July 11th, 03:28 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139