[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1006
  • Last Modified:

Problem Updating Multiple Rows within a GridView

I am trying to upgrade multiple fields within a gridview  but can't seem to see what I am missing in my in my code behind.  The code on my button click is as follows:

I am trying to meet a deadline tonight and have been working on this one quirk for the last 6 hours.  Any help would be greatly appreciated.
protected void ButtonPickOrder_Click(object sender, EventArgs e)
    {
        VpaimsTableAdapters.Warehouse_LocationsTableAdapter WarehouseAdapter = new VpaimsTableAdapters.Warehouse_LocationsTableAdapter();
        string _number;
        int _pallets;
        int _cases = 0;
        int _julien;
        int _aisle = 0;
        string _location;
        
        foreach (GridViewRow  row in GridView1.Rows)
        {
            _number = Convert.ToString(GridView1.FindControl("Number"));
            _pallets = Convert.ToInt32(GridView1.FindControl("Pallets"));
            _julien = Convert.ToInt32(GridView1.FindControl("Julien"));
            _location = Convert.ToString(GridView1.FindControl("Location"));
 
            WarehouseAdapter.Update(_number, _pallets, _cases, _julien, _aisle, _location);
            GridView1.DataBind();
            
        }

Open in new window

0
imateyelectronics
Asked:
imateyelectronics
1 Solution
 
digitalZoCommented:
Debug using a breakpoint and check at each row what's getting updated. Maybe you'll come to know what and where the problem is.
0
 
monarch_ilhanCommented:
instead of
_number = Convert.ToString(GridView1.FindControl("Number"));

try this
_number = Convert.ToString(row.FindControl("Number"));
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now