Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Uppercasing column in grid before updating
Message
De
20/09/2011 14:50: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:
01524063
Vues:
31
Hi Ron,

I am wondering if you can just adjust the Entity object property to store the values in upper case. I assume this is because you want everything stored this way and don't care if the user sees it as upper case or not.
Timothy

>This is so not pretty, and I am sure it has to do with not understanding what and when MM.NET is doing binding in the background, but I just made this work with a monstrous kludge.
>
>After the initial save back of the dataset from the grid when adding the record, I then use the index to point to the row in the dataset, uppercase the values in the dataset, then DO ANOTHER SAVE. When walking through with DEBUG, before the first save, the values in the new row are EMPTY, they do not even show the data that has been entereded into the added row on the grid.
>
>The data is there on RETURN from the save, as entered.
>
>At that point, I uppercased as shown. I also had to add the SetCurrentDataSet. Hmm.
>
>On the second save pass, the uppercased values are saved.
>
>
>        protected void grdCTInventoryGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
>        {
>            // Get the item to be updated
>            this.grdCTInventoryGrid.EditIndex = e.RowIndex;
>
>            // Retrieve the previous DataSet
>            DataSet dsCTInventory = (DataSet)Session["dsCTInventory"];
>
>            // Save the DataSet (the GridView automatically binds back)
>            this.Save(this.oCTInventory, dsCTInventory);
>
>            dsCTInventory.Tables["CtInventory"].Rows[e.RowIndex]["Inv_Code"] = (string)dsCTInventory.Tables["CtInventory"].Rows[e.RowIndex]["Inv_Code"].ToString().ToUpper();
>            dsCTInventory.Tables["CtInventory"].Rows[e.RowIndex]["Inv_Group1"] = (string)dsCTInventory.Tables["CtInventory"].Rows[e.RowIndex]["Inv_Group1"].ToString().ToUpper();
>            dsCTInventory.Tables["CtInventory"].Rows[e.RowIndex]["Inv_Group2"] = (string)dsCTInventory.Tables["CtInventory"].Rows[e.RowIndex]["Inv_Group2"].ToString().ToUpper();
>            dsCTInventory.Tables["CtInventory"].Rows[e.RowIndex]["Inv_Descr"] = (string)dsCTInventory.Tables["CtInventory"].Rows[e.RowIndex]["Inv_Descr"].ToString().ToUpper();
>
>            this.oCTInventory.SetCurrentDataSet(dsCTInventory);
>
>            // 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);
>        }
>
>
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform