update multiple gridview rows at once in

Posted on 2008-11-19
Last Modified: 2012-06-27
I am using a gridview to allow users to enter data into multiple rows.  I want them to be able to click on one Update button and save all the rows at once.
I am using in VS 2005 and cannot find a simple way to display the gridview in edit mode.  I have found many examples for C+ but not VB.
Can I programatically databind() the gridview and then have it display the one column I need to allow data entry in edit mode??

Question by:PEAKTT
    1 Comment
    LVL 4

    Accepted Solution

    Yes you can:

    Update Featured Items List <asp:ImageButton ImageUrl="~/images/Update.gif" runat="server" OnClick="UpdateFeatured_Click" ID="UpdateFeatured" />

    <asp:GridView ID="grdFeatured" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID="dtSrcSelFeat" AutoGenerateColumns="False" BorderWidth="0px" PageSize="12" DataKeyNames="ProductID">
    <asp:BoundField DataField="productname" HeaderText="Product Name"/>
    Is Featured
    <asp:CheckBox ID="chkFeat" runat="server" />

    Protected Sub UpdateFeatured_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles UpdateFeatured.Click
    For Each row In GridView1.Rows
    txtQty = CType(row.Findcontrol("txtQuantity"), TextBox)
    ' Do your stuff here
    If (txtQty.Text <> "") Then
    If Convert.ToInteger(txtQty.Text) > 0 Then
    'Create entry into the Orders table here
    End If
    End If
    End Sub

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    746 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

    20 Experts available now in Live!

    Get 1:1 Help Now