Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Uppercasing column in grid before updating
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Uppercasing column in grid before updating
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01524049
Message ID:
01524049
Vues:
88
I have an ASP.NET mm.net gridview working using the jump start to add a new row, then enter data into the row in the grid, then save it.

I figured out how to convert certain fields to templates so I had textboxes and could enforce max length restrictions during data entry so I did not get an unhandled SQL error when the proc to update chokes on a field exceeding max length in the database table column definition.

I am stuck on the final thing I need to do, i.e. upper case the data entry for certain columns.

The following code works in so far as during debug stepthrough the e.NewValue sees the lower case data and uppercases it.

But the upper cased values do NOT get written back to SQL during the this.Save. I have tried it both before and after the line retrieving the pervious datatset.
            // Get the item to be updated
            this.grdCTInventoryGrid.EditIndex = e.RowIndex;

            // Retrieve the previous DataSet
            DataSet dsCTInventory = (DataSet)Session["dsCTInventory"];

            // We want to make sure the values are upper case.
            e.NewValues["Inv_Code"] = e.NewValues["Inv_Code"].ToString().ToUpper();
            e.NewValues["Inv_Group1"] = e.NewValues["Inv_Group1"].ToString().ToUpper();
            e.NewValues["Inv_Group2"] = e.NewValues["Inv_Group2"].ToString().ToUpper();
            e.NewValues["Inv_Descr"] = e.NewValues["Inv_Descr"].ToString().ToUpper();

            // Save the DataSet (the GridView automatically binds back)
            this.Save(this.oCTInventory, dsCTInventory);

            // Reset the edited item and rebind the GridView
            this.grdCTInventoryGrid.EditIndex = -1;
            this.BindControl(this.grdCTInventoryGrid);
        }

I really need to be able force these values to uppercase, that is our standard for certain data, including this inventory control file from which data entry staff select during sales operations.
Any way to make this work? What am I missing in the flow of data here?

I am working with the latest release of MM.NET in Visual Studio 2010.

Thanks.
Ronald D. Edge
Retired from Indiana University Mar 1, 2011

"You've got to be very careful if you don't know where you are going,
because you might not get there."
“When you come to the fork in the road, take it.”
--Yogi Berra
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform