Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Uppercasing column in grid before updating
Message
De
20/09/2011 14:48:10
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
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:
01524062
Vues:
38
Hi Ron,

What do you do with it if the length is too long? Assuming you don't just trim it, you could be using the Rules object to validate data and providing a message back to the user.

Also, where do you have the code below that you are trying to change the saved data? Is this in a pre_save hook?


>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.
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform