Results 1 to 3 of 3

Thread: [2.0] Help in Understanding this Code

  1. #1

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    830

    Exclamation [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

  2. #2
    Fanatic Member popskie's Avatar
    Join Date
    Jul 2005
    Location
    In my chair
    Posts
    666

    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.

  3. #3

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    830

    Re: [2.0] Help in Understanding this Code

    Thank you very much for your reply

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width