[2.0] Help in Understanding this Code
hi Guys
Am running through a code by a previous Developer and am trying to understand what he was doing , i do things differently, he likes XML and i like doing Direct Access to the DB , but going through a Data Layer , So i can Across a Code that was a little bit Confusing for me , because i was not doing things this way. i have the Following code
Code:
string sql = "";
foreach (UltraGridRow row in ultraGridSubjects.Rows)
{
foreach (UltraGridCell cell in row.Cells)
{
if ((cell.Key == "Term") || (cell.Key == "Container"))
{
Type typ = cell.Value.GetType();
if (typ.FullName == "System.String")
{
foreach (ValueListItem vItem in cell.Column.ValueList.ValueListItems)
{
if (vItem.DisplayText == cell.Value.ToString())
{
cell.Value = vItem.DataValue;
}
}
}
}
}
}
sql = "sp_Subjects_Save '" + CommonFunctions.BuildXmlFromUltraGrid(ultraGridSubjects) + "' ";
((ControlDesk)Page.Master).WarningText = CommonFunctions.ExecuteStoredProc(sql);
ultraGridSubjects.DataBind();
The UltraGrid is a third party Control, thats like Gridview in ASP.NET 2.0, can someone summarise the code and tell what is happing in this code like this part
Code:
sql = "sp_Subjects_Save '" + CommonFunctions.BuildXmlFromUltraGrid(ultraGridSubjects) + "' ";
((ControlDesk)Page.Master).WarningText = CommonFunctions.ExecuteStoredProc(sql);
Thanks
Re: [2.0] Help in Understanding this Code
I believe they are just looping the entire row of the grid then get the value and value type of the cell. If the value of celll is a string type then it will loop to the valueListItem object then compare the value of valuelistItem versun the cell value if equal then assign the cell value.
Re: [2.0] Help in Understanding this Code
Thank you very much for your reply