Gridview or DataGrid

Posted on 2008-11-19
Last Modified: 2012-05-05
Let me first start by saying I'm very new to, and I'm trying to duplicate something that I've been doing in Visual Basic 6.0 on an page.

Here is what I'm trying to accomplish and hopefully someone can tell me how I can do this using something like a GridView or something similar.

In my VB program I use a DataGrid to pull in a recordset that has rows like Endpoint Number, Endpoint Name, TransitAmt, TransitItems.  The Endpoint Number and Endpoint Name come from a SQL Stored Procedure and TransitAmt and TransitItems are set empty or zero in the recordset and using the DataGrid the user updates the endpoints with the correct Amounts and Item Counts.  Once the user has input the data and hit the OK button the data gets sent to another stored procedure that updates a different table then where the endpoints orginially came from.

To make this more simple I need to pull in data from one table using a stored procedure and update a different table using a stored procedure, with input from a Gridview or something simlar.  I can't use Text Boxes since the endpoints change from month to month and I don't want to have to constatly keep updating the page with new or delete text boxes.

Question by:smithmrk
    LVL 96

    Expert Comment

    by:Bob Learned
    GridView is a much better control, as the DataGrid is in there for backwards compatibility with ASP.NET 1.1 web sites.
    LVL 26

    Accepted Solution

    a sample for how you can edit your data and save it to the database using a gridview

    Author Comment

    Thanks for getting back to me, however as new as I am to this stuff none of what you said makes any sense to me.

    Maybe I worded my question wrong.

    In my VB Program I have a ADODB Recordset that I pull in all Fields from the SQL Stored Procedure.  I then bind this recordset to the DataGrid and allow the operators to enter the Item Amounts and Item Counts.  Once done I loop though the DataGrid and update the Database.

    How can I do this in using the Gridview or is there a DataGrid in that I'm not aware of?

    I don't mind using the GridView, but I seem to be having a hard time binding the ADODB Recordset to the GridView.

    Sample Code would be great or some advice on how I can accomplish better.

    LVL 96

    Expert Comment

    by:Bob Learned
    ADO classic is old technology, and .NET is centered around ADO.NET, so you cannot bind a .NET control, like the GridView, to an ADODB RecordSet.

    Have you learned anything about ADO.NET?  ASP.NET has an SqlDataSource class that you can use to get the data from the database, and binds directly to the GridView.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now