protected void rgGrid_UpdateCommand(object sender, GridCommandEventArgs e)
 {
     try
     {
         UserControl userControl          = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
         Label       errorMsg             = (Label)userControl.FindControl("lblErrorMessage");
         clsStatusCodeNonCourierEDI oVend = populateObj(userControl);
         oVend.idStatusCodesNonCourierEDI = Convert.ToInt16((userControl.FindControl("lblShippingVendorID") as Label).Text);
         string updateMsg = "";
         if (IsValid)
         {
             if (oVend != null)
             {
                 updateMsg = SrvStatusCodeNonCourierEDI.UpdatetatusCode(oVend);
                 if (updateMsg == "")
                 {
                     pnlsuccess.Visible = true;
                     lblSuccess.Text    = "Successfully updated Status Code " + "'" + oVend.StatusCode + "'";
                 }
                 else
                 {
                     errorMsg.Visible = true;
                     errorMsg.Text    = updateMsg;
                     e.Canceled       = true;
                 }
             }
         }
         else
         {
             errorMsg.Visible = true;
             errorMsg.Text    = "Please enter Required fields";
             e.Canceled       = true;
         }
     }
     catch (Exception ex)
     {
         pnlDanger.Visible = true;
         lblDanger.Text    = ex.Message.ToString();
         e.Canceled        = true;
     }
 }
 protected void rgGrid_InsertCommand(object sender, GridCommandEventArgs e)
 {
     try
     {
         UserControl userControl          = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
         Label       errorMsg             = (Label)userControl.FindControl("lblErrorMessage");
         clsStatusCodeNonCourierEDI oVend = populateObj(userControl);
         string insertMsg = "";
         if (IsValid)
         {
             if (oVend != null)
             {
                 insertMsg = SrvStatusCodeNonCourierEDI.UpdatetatusCode(oVend);
                 if (insertMsg == "")
                 {
                     pnlsuccess.Visible = true;
                     lblSuccess.Text    = "Successfully Added New Status Code " + oVend.StatusCode;
                 }
                 else
                 {
                     errorMsg.Visible = true;
                     errorMsg.Text    = insertMsg;
                     e.Canceled       = true;
                 }
             }
         }
         else
         {
             errorMsg.Visible = true;
             errorMsg.Text    = "Please enter Required fields";
             e.Canceled       = true;
         }
     }
     catch (Exception ex)
     {
         pnlDanger.Visible = true;
         lblDanger.Text    = ex.Message.ToString();
         e.Canceled        = true;
     }
 }