Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Extreme newbie DataGrid question (ASP.NET, ASP.NET Web Matrix)

    Just downloaded the free ASP.NET Web Matrix IDE tool from MS to start looking into the world of ASP.NET. This is a confusing world!

    But this is my little bittie question: What do you need to do to create a Datagrid to pull/display info from an Access db? I used a code snippet to setup a connection to a db and am not sure what to put in the DataSource section. Eventually I'd like to see the minimum amount of code needed to interact with a db in order to not rely on canned code fragments, but ya gotta start somewhere.

    BTW: WebMatrix is cool! It sets itself up as a little ASPX webserver.

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extreme newbie DataGrid question (ASP.NET, ASP.NET Web Matrix)

    Hi Steve,

    One of the best articles I've seen to date on the datagrid is on 4 Guys from Rolla (http://aspnet.4guysfromrolla.com/articles/040502-1.aspx).

    The gist of it is that you usually use a function in a business component (just a class file) to return a Dataset or other data object (i.e. Data Table, Data View, DataReader, etc...). Then, in the front-end (code-behind file or even in the ASPX page), set the Data Source property of the datagrid to the result of the function. Then call the Databind() method of the Datagrid. That's all there is to it!

    Also, if you don't mind a lot of pink color, check out this helpful site: DataGrid Girl

    Hope this helps!

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extreme newbie DataGrid question (ASP.NET, ASP.NET Web Matrix)

    yeesh!! you're right - a lot of pink.

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extreme newbie DataGrid question (ASP.NET, ASP.NET Web Matrix)

    actually one other neat trick if you just want to poke around with a datagrid: using ASP.NET Web Matrix, setup a connection to a db and, with the db window open, drag a table to the HTML build screen. If the table has an index, a datagrid will automatically be generated. you can then tweak/poke/prod/destroy at will. AND, the code generated is well-formatted and easy to understand.

    I don't know if VS.NET can do this too, but I'm willing to be, say, 5 cyber-dollars that it can.

    Also, ASP.NET Web Matrix gives you a cold-fusioney method for setting up db connections (Access and SQL Server). Neat!!

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extreme newbie DataGrid question (ASP.NET, ASP.NET Web Matrix)

    I use Visual Studio (2003) and have not had the opportunity to exploit the capabilities of the development environment's interface. I usually find myself doing the datagrid from scratch and mostly with code (as far as data binding goes) due to the nature of the data (coming in from business objects) and the heavily customized datagrid features I find myself using.

    I've heard that the next version of .NET (2.0) and Studio should have even MORE neat, time-saving features. I look forward to seeing what it will do. However, I remain cautious with features that do TOO much for you. Based on Microsoft's reputation (*cough*FrontPage*cough*AccessWizards*cough*), when the automation is so extensive, the code behind is usually quite messy...(fingers crossed)

    Regardless - thanks for pointing out a potentially useful feature!

  6. #6
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extreme newbie DataGrid question (ASP.NET, ASP.NET Web Matrix)

    I don't have Visual Studio, and am not officially employed as a programmer -- so I don't anticipate getting a full-blown VS IDE. The thing I found, WebMatrix, is a free ASP.NET IDE developed my MS engineers in their spare time to give people the ability to work with ASP.NET (actually, VB/C#/J#) and it's darn cool. From what I've done so far, any automatic coding (say, by dragging a table into the ASP page to create a datagrid on-the-fly) is very clean, UNLIKE FrontPage crapola. I think the fact that MS people took it upon themselves to provide this tool means they, like any good engineer, appreciate clean code. FP extensions, for whatever use you may find in them, have that sleezy MS marketing aura: use FP extensions and be tied to MS products forever!! Mwaa-ha-ha-haaa!

    This WebMatrix tool seems to lack that kind of 'charm'. But, all in all, I agree that code should be actually written by oneself, not some wizard. There's nothing like looking at some code and having *no idea* how it works or why...esp. when you need to fix it! <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

Posting Permissions

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