Ejemplo n.º 1
0
 protected void BindVHCBProgram()
 {
     try
     {
         DataTable table = AccountData.GetVHCBProgram();
         ddlVHCBProgram.DataSource     = table;
         ddlVHCBProgram.DataValueField = "typeid";
         ddlVHCBProgram.DataTextField  = "Description";
         ddlVHCBProgram.DataBind();
         ddlVHCBProgram.Items.Insert(0, new ListItem("Select", "NA"));
     }
     catch (Exception ex)
     {
         lblErrorMsg.Text = ex.Message;
     }
 }
Ejemplo n.º 2
0
 protected void gvUserInfo_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)
     {
         CommonHelper.GridViewSetFocus(e.Row);
     }
     {
         //Checking whether the Row is Data Row
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             DropDownList ddlPrg = (e.Row.FindControl("ddlEditVhcbPrg") as DropDownList);
             TextBox      txtPrg = (e.Row.FindControl("txtDfltPrg") as TextBox);
             if (ddlPrg != null)
             {
                 DataTable dtable = AccountData.GetVHCBProgram();
                 ddlPrg.DataSource     = dtable;
                 ddlPrg.DataValueField = "typeid";
                 ddlPrg.DataTextField  = "Description";
                 ddlPrg.DataBind();
                 ddlPrg.Items.Insert(0, new ListItem("Select", "NA"));
                 string itemToCompare = string.Empty;
                 if (txtPrg != null)
                 {
                     foreach (ListItem item in ddlPrg.Items)
                     {
                         itemToCompare = item.Text;
                         if (txtPrg.Text.ToLower() == itemToCompare.ToLower())
                         {
                             ddlPrg.ClearSelection();
                             item.Selected = true;
                         }
                     }
                 }
             }
         }
     }
 }