Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8041173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:07:42+00:00 2026-06-05T04:07:42+00:00

I have a gridview with four template fields that I need to be able

  • 0

I have a gridview with four template fields that I need to be able to put info into to save to the database. When I hit the edit button and my columns change into edit mode I can enter information just fine… But when I try to loop through the control to get the information it doesn’t pick anything up?

Private Sub gvOLIAdj_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gvOLIAdjst.RowEditing     
    gvOLIAdjst.EditIndex = e.NewEditIndex     
    BindData()  
End Sub 

Here is the update event that I have so far… any ideas? Am I just not doing this right?

Private Sub gvOLIAdj_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvOLIAdjst.RowUpdating     
Dim dts As DataTable = DirectCast(Session("BudgetsTable"), DataTable)     
Dim row As GridViewRow = gvOLIAdjst.Rows(e.RowIndex)     
If DirectCast(row.FindControl("txtItemTempTtlAmt"), TextBox).Text = "" Then           
    lblError.Text = "Invalid Entry. Correct and try again"         
    e.Cancel = True     
Else        
    lblError.Text = ""         
    dts.Rows(row.DataItemIndex)("Approval Date") = DirectCast(row.FindControl("txtItemTempApprDt"), TextBox).Text         
    dts.Rows(row.DataItemIndex)("Total Amount") = DirectCast(row.FindControl("txtItemTempTtlAmt"), TextBox).Text         
    dts.Rows(row.DataItemIndex)("Comments") = DirectCast(row.FindControl("txtItemTempCmmt"), TextBox).Text         
    dts.Rows(row.DataItemIndex)("Initials") = DirectCast(row.FindControl("lblItemTempInit"), Label).Text          

    gvOLIAdjst.EditIndex = -1         
    BindData()      
End If
If Not IsPostBack Then
        result = dal.dbConnect(sqlconnection, ConfigurationManager.AppSettings("SQLServerConnection"))
        If result = "Successful" Then
            dt = ExecuteInsertUpdateDeleteStoredProc(sqlconnection, "@amt", txtItemTempApprDt.text)
            dbClose
        End If

    End If 
End Sub 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:07:44+00:00Added an answer on June 5, 2026 at 4:07 am

    Rather than pulling the controls from the GridView row, I would use the GridViewUpdateEventArgs variable that you have access to there. You can pull the values from the NewValues property (there are also other useful properties you might need – like OldValues and RowIndex).

    You access them like this:

    e.NewValues("Data Field Name").ToString()
    

    Where “Data Field Name” is the key for that value (the name of the field in your GridViews dataset).

    Something like this should work

    dts.Rows(row.DataItemIndex)("Approval Date") = e.NewValues("Approval Date").ToString()
    dts.Rows(row.DataItemIndex)("Total Amount") = e.NewValues("Total Amount").ToString()
    dts.Rows(row.DataItemIndex)("Comments") = e.NewValues("Comments").ToString()
    dts.Rows(row.DataItemIndex)("Initials") = e.NewValues("Initials").ToString()
    

    The keys I’m showing up there might not be exactly right, because I can’t see how your binding data to your GridView. You can set a breakpoint and inspect the “NewValues” dictionary to find the exact keys, I believe. Let me know if you have any questions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview that displays items details, I added two template fields one
I have an ASP.NET GridView that has four columns. The first three are typical
I have a GridView in Which I have four TextBoxes in the Template Field.
I have a gridview that shows an image as part of one of its
I have a gridview that is only shown in a modal popup. right before
I have a gridview and in that gridview i created a list of imagebuttons
I have GridView that allows select. It takes data from EntityDataSource . How do
I have GridView bound to some List. In layout I created following template field:
I have a SQLite database that is displayed in a data grid view in
I have GridView with Template Column.Inside the template column i have asp:hiddenfield. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.