/// <summary> /// The Page_Load server event handler on this user control is used /// to populate the current portals list from the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Page_Load(object sender, System.EventArgs e) { portals = new ArrayList(); PortalsDB portalsDb = new PortalsDB(); SqlDataReader dr = portalsDb.GetPortals(); try { while (dr.Read()) { PortalItem p = new PortalItem(); p.Name = dr["PortalName"].ToString(); p.Path = dr["PortalPath"].ToString(); p.ID = Convert.ToInt32(dr["PortalID"].ToString()); portals.Add(p); } } finally { dr.Close(); //by Manu, fixed bug 807858 } // If this is the first visit to the page, bind the tab data to the page listbox if (Page.IsPostBack == false) { portalList.DataBind(); } }
/// <summary>Page Load.</summary> public void Page_Load ( object sender, EventArgs e ) { string databaseConnectionString = null; serverMapPath = this.MapPath(""); if ( serverMapPath != null) { filenameConfigurationXml = serverMapPath + @"\" + filenameConfigurationXml; }//if ( serverMapPath != null) if ( !Page.IsPostBack ) { UtilitySQLDMO.ConfigurationFile(); databaseConnectionString = UtilitySQLDMO.DatabaseConnectionString; ListBoxSQLDMOAdmonish.DataSource = UtilitySQLDMO.Admonish; ListBoxSQLDMOAdmonish.DataBind(); ListBoxSQLDMOAdmonish.SelectedIndex = 0; }//if ( !Page.IsPostBack ) }//Page_Load
private void BindSurveyDropDownLists() { SurveysListBox.DataSource = new Surveys().GetUnAssignedSurveysList(UserId).Surveys.OrderBy(x => x.Title); SurveysListBox.DataMember = "Surveys"; SurveysListBox.DataTextField = "Title"; SurveysListBox.DataValueField = "SurveyId"; SurveysListBox.DataBind(); UserSurveysListBox.DataSource = new Surveys().GetAssignedSurveysList(UserId).Surveys.OrderBy(x => x.Title); UserSurveysListBox.DataMember = "Surveys"; UserSurveysListBox.DataTextField = "Title"; UserSurveysListBox.DataValueField = "SurveyId"; UserSurveysListBox.DataBind(); UserRolesListBox.DataSource = new Roles().GetRolesOfUser(UserId); UserRolesListBox.DataMember = "Roles"; UserRolesListBox.DataTextField = "RoleName"; UserRolesListBox.DataValueField = "RoleId"; UserRolesListBox.DataBind(); RolesListBox.DataSource = new Roles().GetUnassignedRolesToUser(UserId); RolesListBox.DataMember = "Roles"; RolesListBox.DataTextField = "RoleName"; RolesListBox.DataValueField = "RoleId"; RolesListBox.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { // Create the command and the connection. string connectionString = "Data Source=localhost;" + "Initial Catalog=Northwind;Integrated Security=SSPI"; string sql = "SELECT EmployeeID, TitleOfCourtesy + ' ' + FirstName + ' ' + LastName As FullName FROM Employees"; SqlConnection con = new SqlConnection(connectionString); SqlCommand cmd = new SqlCommand(sql, con); // Open the connection and get the DataReader. con.Open(); SqlDataReader reader = cmd.ExecuteReader(); // bind the reader to the Listbox Listbox1.DataSource = reader; Listbox1.DataBind(); // Close the reader and the connection. reader.Close(); con.Close(); } }
/// <summary> /// Procedimiento para cargar las listas /// </summary> private void LlenarListas() { // Cargo los clientes //LlenarCombos.Clientes(lstClientes, UnidadNegocioID); ICliente oCliente = ClienteFactory.GetCliente(); lstClientes.DataSource = oCliente.GetClientesConsultaDataSet().Datos.Select("", "RazonSocial"); lstClientes.DataValueField = "ClienteID"; lstClientes.DataTextField = "RazonSocial"; lstClientes.DataBind(); // Cargo las unidades de venta LlenarCombos.UnidadesVenta(lstUnidadVenta); // Cargo los tarifarios de fletes ITarifarioFlete tarifarioFlete = TarifarioFleteFactory.GetTarifarioFlete(); DsTarifariosFlete dsTarifariosFletes = tarifarioFlete.GetTarifariosFleteDataSet(); lstTarifariosDeFletes.DataSource = dsTarifariosFletes.Datos; lstTarifariosDeFletes.DataValueField = "TarifarioFleteID"; lstTarifariosDeFletes.DataTextField = "TarifarioFleteDescrip"; lstTarifariosDeFletes.DataBind(); // Cargo los tarifarios de retiro/entrega ITarifario tarifarioRetiroEntrega = TarifarioFactory.GetTarifario(""); DsTarifarioClienteRetiroEntrega dsTarifarioRetiroEntrega = (DsTarifarioClienteRetiroEntrega)tarifarioRetiroEntrega.GetTarifariosDataSet(); lstTarifariosRetiroEntrega.DataSource = dsTarifarioRetiroEntrega.Datos; lstTarifariosRetiroEntrega.DataValueField = "TarifarioClienteRetiroEntregaID"; lstTarifariosRetiroEntrega.DataTextField = "TarifarioClienteRetiroEntregaDescrip"; lstTarifariosRetiroEntrega.DataBind(); }
public void BindList(System.Web.UI.WebControls.ListBox theListBox, DataTable theDT, string theTextField, string theValueField) { theListBox.DataSource = theDT; theListBox.DataTextField = theTextField; theListBox.DataValueField = theValueField; theListBox.DataBind(); }
private void LlenarComboEmpresas() { try { IServicioTransporte servTransporte = ServicioTransporteFactory.GetServicioTransporte(); Session["dsEmpresas"] = new DataSet(); DataSet ds = servTransporte.GetEmpresasAgrupadasDataSet(); ddlEmpresas.DataSource = ds; ddlEmpresas.DataValueField = "CodigoEmpresa"; ddlEmpresas.DataTextField = "CodigoEmpresa"; ddlEmpresas.DataBind(); Session["dsEmpresas"] = ds; } catch (Exception ex) { string mensaje = ex.Message; try { mensaje = this.TraducirTexto(ex.Message); if (mensaje == "" || mensaje == null) { mensaje = ex.Message; } } catch (Exception) { mensaje = ex.Message; } ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(mensaje); } }
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { // Create a connection SqlConnection conn = new SqlConnection(); conn.ConnectionString = "Server=localhost;" + "Database=ADONET;" + "User ID=ADOGUY;" + "Password=ADOGUY"; conn.Open(); // Create a Command to read the product Descriptions/ID's SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT Description, ProductID FROM PRODUCT"; // Create a DataReader to use to bind to the listbox SqlDataReader rdr = cmd.ExecuteReader(); // Bind to the ListBox theListBox.DataSource = rdr; theListBox.DataTextField = "Description"; theListBox.DataValueField = "ProductID"; theListBox.DataBind(); // Close the Connection conn.Close(); } }
protected void FillObjects(string xtype, string user) { lblRes.Text = string.Empty; try { SqlConnection SqlCon = new SqlConnection(ConnectionString); SqlDataAdapter DA = new SqlDataAdapter("Select name,id from sysobjects where uid=USER_ID('" + user + "') AND xtype='" + xtype + "' order by name", SqlCon); SqlCon.Open(); DataSet DS = new DataSet(); try { DA.Fill(DS, "Table"); lbObjects.DataSource = DS; lbObjects.DataTextField = "name"; lbObjects.DataValueField = "id"; lbObjects.DataBind(); lbObjects.SelectedIndex = 0; } finally { SqlCon.Close(); } } catch (Exception ex) { lblRes.Text = "Error: " + ex.Message; } }
}//Page_Load /// <summary>ListBoxRegistry_PreRender</summary> public void ListBoxRegistry_PreRender ( object sender, EventArgs e ) { string exceptionMessage = null; string[] registry = null; if ( !Page.IsPostBack ) { if ( ListBoxRegistry.Items.Count < 1 ) { UtilityString.ArrayCopy ( UtilityWhoIs.RegistryWhoIs, ref registry, UtilityWhoIs.RankRegistryWhoIsName, ref exceptionMessage ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; } ListBoxRegistry.DataSource = registry; ListBoxRegistry.DataBind(); }//if ( ListBoxRegistry.Items.Count < 1 ) ListBoxRegistry.SelectedValue = registry[0]; }//if ( !Page.IsPostBack ) }//public void ListBoxRegistry_PreRender()
//******************************************************* // // The BindData helper method is used to update the tab's // layout panes with the current configuration information // //******************************************************* private void BindData() { // Obtain PortalSettings from Current Context PortalSettings portalSettings = (PortalSettings)Context.Items["PortalSettings"]; TabSettings tab = portalSettings.ActiveTab; // Populate Tab Names, etc. tabName.Text = tab.TabName; mobileTabName.Text = tab.MobileTabName; showMobile.Checked = tab.ShowMobile; // Populate checkbox list with all security roles for this portal // and "check" the ones already configured for this tab AdminDB admin = new AdminDB(); IDataReader roles = admin.GetPortalRoles(portalSettings.PortalId); // Clear existing items in checkboxlist authRoles.Items.Clear(); ListItem allItem = new ListItem(); allItem.Text = "All Users"; if (tab.AuthorizedRoles.LastIndexOf("All Users") > -1) { allItem.Selected = true; } authRoles.Items.Add(allItem); while (roles.Read()) { ListItem item = new ListItem(); item.Text = (String)roles["rolename"]; item.Value = roles["roleid"].ToString(); if ((tab.AuthorizedRoles.LastIndexOf(item.Text)) > -1) { item.Selected = true; } authRoles.Items.Add(item); } // Populate the "Add Module" Data moduleType.DataSource = admin.GetModuleDefinitions(portalSettings.PortalId); moduleType.DataBind(); // Populate Right Hand Module Data rightList = GetModules("RightPane"); rightPane.DataBind(); // Populate Content Pane Module Data contentList = GetModules("ContentPane"); contentPane.DataBind(); // Populate Left Hand Pane Module Data leftList = GetModules("LeftPane"); leftPane.DataBind(); }
/// <summary> /// Procedimiento para cargar las listas /// </summary> private void LlenarListas() { // // Obtengo desde que fecha hay que cargar los combos peridos // IReporteComisiones reporteComisiones = ReporteComisionesFactory.GetReporteComisiones(); // DateTime DesdeFecha = reporteComisiones.ObtenerFechaInicialLiquidacion(); // // Cargo los combos periodos // DateTime fechaMaximaAProcesar = DateTime.Now; // fechaMaximaAProcesar = fechaMaximaAProcesar.AddMonths(1); // while (DesdeFecha < fechaMaximaAProcesar) // { // ListItem item = new ListItem(Fechas.ObtenerNombreMes(DesdeFecha) + " (" + DesdeFecha.Year + ")", DesdeFecha.ToString()); // ddlPeriodoDesde.Items.Add(item); // ddlPeriodoHasta.Items.Add(item); // DesdeFecha = DesdeFecha.AddMonths(1); // } // // Selecciono el último periodo en los combos de periodos // ddlPeriodoDesde.SelectedValue = ddlPeriodoDesde.Items[ddlPeriodoDesde.Items.Count - 1].Value; // ddlPeriodoHasta.SelectedValue = ddlPeriodoHasta.Items[ddlPeriodoHasta.Items.Count - 1].Value; // Cargo las agencias IAgencia agencias = AgenciaFactory.GetAgencia(); lstAgencia.DataSource = agencias.GetAgenciasDataSet().Datos.Select("", "RazonSocial"); lstAgencia.DataValueField = "AgenciaId"; lstAgencia.DataTextField = "RazonSocial"; lstAgencia.DataBind(); }
/// <summary> /// The Page_Load server event handler on this user control /// is used to populate the current tab settings from the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Page_Load(object sender, System.EventArgs e) { portalTabs = new TabsDB().GetTabsFlat(portalSettings.PortalID); // If this is the first visit to the page, bind the tab data to the page listbox if (!Page.IsPostBack) { // Set the ImageUrl for controls from current Theme upBtn.ImageUrl = this.CurrentTheme.GetImage("Buttons_Up", "Up.gif").ImageUrl; downBtn.ImageUrl = this.CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl; tabList.DataBind(); // 2/27/2003 Start - Ender Malkoc // After up or down button when the page is refreshed, // select the previously selected tab from the list. if (Request.Params["selectedtabID"] != null) { try { int tabIndex = Int32.Parse(Request.Params["selectedtabID"]); SelectTab(tabIndex); } catch { } } // 2/27/2003 End - Ender Malkoc } }
private void BindSubSys() { mpViews.SelectedIndex = 0; lstSubSys.DataSource = LoadSystems(); lstSubSys.DataBind(); lstSubSys.SelectedIndex = 0; }
//所有菜单栏目 private void CreateAllItems(ListBox listcontrolleft) { Johnny.CMS.BLL.SystemInfo.MenuCategory bll = new Johnny.CMS.BLL.SystemInfo.MenuCategory(); listcontrolleft.DataSource = bll.GetList(); listcontrolleft.DataTextField = "MenuCategoryName"; listcontrolleft.DataValueField = "MenuCategoryId"; listcontrolleft.DataBind(); }
//所有权限 private void CreatelstAccount(ListBox listcontrol, int PermissionCategoryId) { Johnny.CMS.BLL.Access.Permission bll = new Johnny.CMS.BLL.Access.Permission(); listcontrol.DataSource = bll.GetList(PermissionCategoryId); listcontrol.DataTextField = "PermissionName"; listcontrol.DataValueField = "PermissionId"; listcontrol.DataBind(); }
public void ListBindToData(ListBox lb, DataTable dt, string dataTextField, string dataValueField) { lb.Items.Clear(); lb.DataSource = dt; lb.DataTextField = dataTextField; lb.DataValueField = dataValueField; lb.DataBind(); }
}//public void Server_Index_Changed(Object sender, EventArgs e) /// <summary>ServerSelected()</summary> public void ServerSelected() { bool system = false; bool user = false; string[] database = null; string exceptionMessage = null; string[] selectedServer = null; string sqlServerLoginUserName = null; string sqlServerPassword = null; try { UtilityWebControl.SelectedItem ( ListBoxServer, ref selectedServer ); if ( selectedServer == null || selectedServer.Length != 1 ) { return; } ViewState["SQLServerManagementObjectsSMOPage_ServerSelectedFirst"] = selectedServer[0]; sqlServerLoginUserName = SQLServerLoginUserName; sqlServerPassword = SQLServerPassword; system = CheckBoxSystem.Checked; user = CheckBoxUser.Checked; UtilitySQLServerManagementObjectsSMO.DatabaseList ( ref selectedServer[0], ref exceptionMessage, ref database, ref sqlServerLoginUserName, ref sqlServerPassword, ref system, ref user ); if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) if ( database == null || database.Length < 1 ) { return; }//if ( database == null || database.Length < 1 ) ListBoxDatabase.DataSource = database; ListBoxDatabase.DataBind(); }//try catch ( System.Exception exception ) { exceptionMessage = "System.Exception: " + exception.Message; }//catch ( System.Exception exception ) if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) }//public void ServerSelected(Object sender, EventArgs e)
public void BindData() { if (((PageBase)Page).NSurveyUser.Identity.IsAdmin || ((PageBase)Page).NSurveyUser.Identity.HasAllSurveyAccess) { AnswerTypeDropDownList.DataSource = new AnswerTypes().GetAnswerTypesList(); } else { AnswerTypeDropDownList.DataSource = new AnswerTypes().GetAssignedAnswerTypesList(((PageBase)Page).NSurveyUser.Identity.UserId, SurveyId); } AnswerTypeDropDownList.DataMember = "AnswerTypes"; AnswerTypeDropDownList.DataTextField = "Description"; AnswerTypeDropDownList.DataValueField = "AnswerTypeID"; AnswerTypeDropDownList.DataBind(); ((PageBase)Page).TranslateListControl(AnswerTypeDropDownList); AnswerTypeDropDownList.SelectedValue = "1"; AvailablePublishersListBox.DataSource = new Answers().GetPublishersList(AnswerId); AvailablePublishersListBox.DataTextField = "AnswerText"; AvailablePublishersListBox.DataValueField = "AnswerId"; AvailablePublishersListBox.DataBind(); SubscribedListbox.DataSource = new Answers().GetSubscriptionList(AnswerId); SubscribedListbox.DataTextField = "AnswerText"; SubscribedListbox.DataValueField = "AnswerId"; SubscribedListbox.DataBind(); if (NSurveyContext.Current.User.Identity.IsAdmin || NSurveyContext.Current.User.Identity.HasAllSurveyAccess) { RegExDropDownList.DataSource = new RegularExpressions().GetAllRegularExpressionsList(); } else { RegExDropDownList.DataSource = new RegularExpressions().GetRegularExpressionsOfUser(NSurveyContext.Current.User.Identity.UserId, SurveyId); } RegExDropDownList.DataTextField = "Description"; RegExDropDownList.DataValueField = "RegularExpressionId"; RegExDropDownList.DataBind(); ((PageBase)Page).TranslateListControl(RegExDropDownList); RegExDropDownList.Items.Insert(0, new ListItem(((PageBase)Page).GetPageResource("NoRegExValidationOption"), "-1")); // Check if any answer has been assigned if (AnswerId == -1) { SwitchToCreationMode(); } else { SwitchToEditionMode(); } }
private void DataBindList() { BTBRandomImageController objCtlBTBRandomImage = new BTBRandomImageController(); ArrayList images = objCtlBTBRandomImage.GetByModules(this.ModuleId); lstImages.DataSource = images; lstImages.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { string staffids = ""; boardid = (Request.QueryString["BoardID"] == null)?0:Convert.ToInt32(Request.QueryString["BoardID"]); classid = (Request.QueryString["classID"] == null)?0:Int32.Parse(Request.QueryString["classID"]); ViewState["boardid"] = boardid; ViewState["classid"] = classid; UDS.Components.Staff staff = new UDS.Components.Staff(); BBSClass bbs = new BBSClass(); SqlDataReader dr = null; SqlDataReader dr1 = null; DataTable dt = new DataTable(); try { dr = bbs.GetBoardMember(); dt = Tools.ConvertDataReaderToDataTable(dr); dt.DefaultView.RowFilter = "board_id=" + boardid; lbBoardMemberList.DataSource = dt.DefaultView; lbBoardMemberList.DataValueField = "staff_id"; lbBoardMemberList.DataTextField = "realname"; lbBoardMemberList.DataBind(); for (int i = 0; i < lbBoardMemberList.Items.Count; i++) { staffids += lbBoardMemberList.Items[i].Value + ","; } if (staffids.Length != 0) { staffids = staffids.Substring(0, staffids.Length - 1); } dr1 = staff.GetRemainStaff(staffids); lbRemainStaffsList.DataSource = dr1; lbRemainStaffsList.DataValueField = "staff_id"; lbRemainStaffsList.DataTextField = "realname"; lbRemainStaffsList.DataBind(); dr1.Close(); } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } } else { classid = Int32.Parse(ViewState["classid"].ToString()); boardid = Int32.Parse(ViewState["boardid"].ToString()); } HyperLink1.DataBind(); }
private void BindAutoData() { Evaluation.EvaluationList evals = new Assignments(Globals.CurrentIdentity).GetAutoEvals(GetAsstID()); lstTests.DataSource = evals; lstTests.DataTextField = Evaluation.NAME_FIELD; lstTests.DataValueField = Evaluation.ID_FIELD; lstTests.DataBind(); }
private void BindGroupList(System.Web.UI.WebControls.ListBox groupListBox) { groupListBox.DataSource = PersonTypes; groupListBox.DataTextField = "Name"; groupListBox.DataValueField = "Id"; groupListBox.DataBind(); groupListBox.Items.Insert(0, new ListItem(AllGroupsLabel, AllIndex)); groupListBox.Items.Insert(1, new ListItem("", "-1")); }
private void BindLocationList(System.Web.UI.WebControls.ListBox locationListBox) { locationListBox.DataSource = Sites; locationListBox.DataTextField = "Name"; locationListBox.DataValueField = "Id"; locationListBox.DataBind(); locationListBox.Items.Insert(0, new ListItem(AllLocationsLabel, AllIndex)); locationListBox.Items.Insert(1, new ListItem("", "-1")); }
private void BindData() { int asstID = Convert.ToInt32(HttpContext.Current.Request.Params["AsstID"]); Evaluation.EvaluationList evals = new Assignments(Globals.CurrentIdentity).GetAutoEvals(asstID); lstTests.DataSource = evals; lstTests.DataTextField = Evaluation.NAME_FIELD; lstTests.DataValueField = Evaluation.ID_FIELD; lstTests.DataBind(); }
//Traer Subrutas de la ruta seleccionada private void ddlRuta_SelectedIndexChanged(object sender, System.EventArgs e) { string mruta = ddlRuta.SelectedValue.Trim(); string origen = "", destino = ""; DataSet dsRutas = new DataSet(); DatasToControls bind = new DatasToControls(); pnlRuta.Visible = pnlSubrutas.Visible = false; lblDesc.Text = lblDestino.Text = lblOrigen.Text = ""; //Consultar info de ruta principal DBFunctions.Request(dsRutas, IncludeSchema.NO, "select rt.MRUT_DESCRIPCION, " + "co.PCIU_NOMBRE concat' (' concat co.pciu_codigoonal concat ')', " + "cd.PCIU_NOMBRE concat' (' concat cd.pciu_codigoonal concat ')', " + "co.pciu_codigo,cd.pciu_codigo " + "from DBXSCHEMA.mrutas rt, DBXSCHEMA.pciudad cd, DBXSCHEMA.PCIUDAD co " + "WHERE co.PCIU_CODIGO=rt.PCIU_COD AND cd.PCIU_CODIGO=rt.PCIU_CODDES AND rt.MRUT_CODIGO='" + mruta + "';"); if (dsRutas.Tables[0].Rows.Count > 0) { lblDesc.Text = dsRutas.Tables[0].Rows[0][0].ToString(); lblOrigenR.Text = lblOrigen.Text = dsRutas.Tables[0].Rows[0][1].ToString(); lblDestinoR.Text = lblDestino.Text = dsRutas.Tables[0].Rows[0][2].ToString(); origen = dsRutas.Tables[0].Rows[0][3].ToString(); destino = dsRutas.Tables[0].Rows[0][4].ToString(); ViewState["ORIGEN"] = origen; ViewState["DESTINO"] = destino; pnlRuta.Visible = pnlSubrutas.Visible = true; } //Ciudades del recorrido dsRutas = new DataSet(); DBFunctions.Request(dsRutas, IncludeSchema.NO, "select mrc.pciu_codigo as valor, pc.PCIU_NOMBRE concat' (' concat pc.pciu_codigoonal concat ')' as texto, mrc.secuencia " + "from dbxschema.mruta_ciudad mrc, dbxschema.pciudad pc " + "where mrc.pciu_codigo=pc.pciu_codigo and mrc.mrut_codigo='" + mruta + "' and mrc.pciu_codigo<>'" + origen + "' and mrc.pciu_codigo<>'" + destino + "' " + "order by mrc.secuencia;"); ViewState["SubRutas"] = dsRutas; lstSubRutas.DataSource = dsRutas; lstSubRutas.DataTextField = "texto"; lstSubRutas.DataValueField = "valor"; lstSubRutas.DataBind(); }
/// <summary> /// Get the current DB stats and fill /// the label with them /// </summary> private void FillFields() { Hashtable resources = ResourceManager.LoadResources("en"); LanguageTextListBox.DataSource = resources; LanguageTextListBox.DataTextField = "Key"; LanguageTextListBox.DataValueField = "Key"; LanguageTextListBox.DataBind(); Response.Write(LanguageTextListBox.Items.Count); }
private void BindPListData() { int asstID = GetAsstID(); Principal.PrincipalList plist = (new Users(Globals.CurrentIdentity)).GetPrincipals( Globals.CurrentUserName, asstID); lstPrincipal.DataSource = plist; lstPrincipal.DataBind(); lstPrincipal.SelectedIndex = 0; }
private void BindPosition() { UDS.Components.Database db = new UDS.Components.Database(); SqlDataReader dr_department = null; db.RunProc("sp_GetAllPosition", out dr_department); lstDeparment.DataSource = dr_department; lstDeparment.DataTextField = "Position_Name"; lstDeparment.DataValueField = "Position_ID"; lstDeparment.DataBind(); }
private void cmdAdd_Click(object sender, System.EventArgs e) { // Create a new pie slice. PieSlice pieSlice = new PieSlice(txtLabel.Text, Single.Parse(txtValue.Text)); pieSlices.Add(pieSlice); // Bind the list box to the new data. lstPieSlices.DataSource = pieSlices; lstPieSlices.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { if (!this.IsPostBack) { oleDbDataAdapter1.Fill(dsCategories1); ListBox1.DataSource = dsCategories1; ListBox1.DataMember = "Categories"; ListBox1.DataTextField = "CategoryName"; ListBox1.DataValueField = "CategoryID"; ListBox1.DataBind(); } }
public static void ddlSongsFill(ListBox ddlSongs) { var response = SessionState.Client.GetAsync("api/song").Result; if (response.IsSuccessStatusCode) { var songs = response.Content.ReadAsAsync<IEnumerable<Song>>().Result; ddlSongs.DataTextField = "Title"; ddlSongs.DataValueField = "Id"; ddlSongs.DataSource = songs.ToList(); ddlSongs.DataBind(); } }
private void Page_Load(object sender, System.EventArgs e) { if (!this.IsPostBack) { ArrayList animals = new ArrayList(); animals.Add("Dog"); animals.Add("Cat"); animals.Add("Goldfish"); ListBox1.DataSource = animals; ListBox1.DataBind(); } }
//Traer Subrutas de la ruta seleccionada private void ddlRuta_SelectedIndexChanged(object sender, System.EventArgs e) { string mruta = ddlRuta.SelectedValue.Trim(); DataSet dsRutas = new DataSet(); DatasToControls bind = new DatasToControls(); pnlRuta.Visible = pnlSubrutas.Visible = false; lblDesc.Text = lblDestino.Text = lblOrigen.Text = ""; DBFunctions.Request(dsRutas, IncludeSchema.NO, "select rt.mrut_codigo as COD,rt.mrut_codigo concat ': ' concat rt.mrut_descripcion as NOM from DBXSCHEMA.mrutas rt join DBXSCHEMA.mruta_intermedia mi on mi.mruta_secundaria=rt.mrut_codigo where mi.mruta_principal='" + mruta + "' ORDER BY mi.mruta_secuencia"); ViewState["SubRutas"] = dsRutas; lstSubRutas.DataSource = dsRutas; lstSubRutas.DataBind(); DBFunctions.Request(dsRutas, IncludeSchema.NO, "select rt.MRUT_DESCRIPCION, co.PCIU_NOMBRE, cd.PCIU_NOMBRE from DBXSCHEMA.mrutas rt, DBXSCHEMA.pciudad cd, DBXSCHEMA.PCIUDAD co WHERE co.PCIU_CODIGO=rt.PCIU_COD AND cd.PCIU_CODIGO=rt.PCIU_CODDES AND rt.MRUT_CODIGO='" + mruta + "';"); if (dsRutas.Tables[1].Rows.Count > 0) { lblDesc.Text = dsRutas.Tables[1].Rows[0][0].ToString(); lblDestino.Text = dsRutas.Tables[1].Rows[0][1].ToString(); lblOrigen.Text = dsRutas.Tables[1].Rows[0][2].ToString(); pnlRuta.Visible = pnlSubrutas.Visible = true; } }
public static ListBox GetListBox(string id, int rowCount, DataView dv, string dataValueField, string dataTextField, ListSelectionMode mode) { ListBox listBox = new ListBox(); listBox.ID = id; listBox.Rows = rowCount; listBox.SelectionMode = mode; listBox.DataSource = dv; listBox.DataValueField = dataValueField; listBox.DataTextField = dataTextField; listBox.DataBind(); return listBox; }
public static void FillDataToListBox(ListBox control, string table, string dataTextField, string dataValueField) { opendata(); string strCommand = "SELECT " + dataTextField + ", " + dataValueField + " FROM " + table; sqladapter = new SqlDataAdapter(strCommand, sqlconn); mydata = new DataSet(); sqladapter.Fill(mydata, strCommand); control.DataSource = mydata; control.DataTextField = dataTextField; control.DataValueField = dataValueField; control.DataBind(); closedata(); }
public static void ddlArtistsFill(ListBox ddlArtists, Action action) { var response = SessionState.Client.GetAsync("api/artist").Result; if (response.IsSuccessStatusCode) { var artists = response.Content.ReadAsAsync<IEnumerable<Artist>>().Result.ToList(); ddlArtists.DataTextField = "Name"; ddlArtists.DataValueField = "Id"; ddlArtists.DataSource = artists.ToList(); ddlArtists.DataBind(); if (action != null) { action(); } } }
public static void FillDataListBox(DataSet dsFull, DataSet dsSelected, ListBox lb, string field, string val, string fieldSelect) { lb.DataSource = dsFull; lb.DataTextField = field; lb.DataValueField = val; lb.DataBind(); if (dsSelected != null && dsSelected.Tables.Count > 0 && dsSelected.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsSelected.Tables[0].Rows.Count; i++) { foreach (ListItem item in lb.Items) { if (item.Value.Equals(dsSelected.Tables[0].Rows[i][fieldSelect].ToString())) item.Selected = true; } } } }
/// <summary> /// 数据集是DataTable,绑定编码、名称 /// </summary> /// <param name="lb">ListBox控件</param> /// <param name="dt">DataTable数据集</param> public static void FillListBox(ListBox lb, DataTable dt) { DataTable temp = new DataTable(); temp = dt.Clone(); foreach (DataRow dr in dt.Rows) { temp.Rows.Add(dr.ItemArray); } lb.DataSource = temp; lb.DataTextField = "姓名"; lb.DataValueField = "编码"; lb.DataBind(); }
private void BindSelectedRolesInListBox(ListBox lst) { try { DataTable dtRoles = GetAllSuperRoles(); if (dtRoles != null) { lst.DataSource = dtRoles; lst.DataTextField = "RoleName"; lst.DataValueField = "RoleID"; lst.DataBind(); } } catch (Exception ex) { ProcessException(ex); } }
public static bool LoadListBoxWithDefault(ListBox _listBox, object objData, string dataTextField, string dataValueField, string defaultText) { if (objData != null) { _listBox.DataSource = null; _listBox.Items.Clear(); _listBox.DataSource = objData; _listBox.DataTextField = dataTextField; _listBox.DataValueField = dataValueField; try { _listBox.DataBind(); } catch { return false; } _listBox.Items.Insert(0, new ListItem(defaultText, "-1")); return true; } return false; }
/// <summary> /// Método que filtra los paquetes del componente seleccionado /// </summary> /// <param name="po_componentePaquete"></param> private void cargarPaquetesPorComponente(cls_componentePaquete po_componentePaquete) { DataSet vo_dataSet = new DataSet(); try { //Si la lista de memoria se encuentra vacía, se realiza la consulta en base de datos if (cls_variablesSistema.vs_proyecto.pComponentePaqueteListaMemoria.Count == 0) { vo_dataSet = cls_gestorComponentePaquete.selectComponentePaquete(cls_variablesSistema.vs_proyecto); foreach (DataRow row in vo_dataSet.Tables[0].Rows) { cls_entregable vo_entregable = new cls_entregable(); cls_componente vo_componente = new cls_componente(); cls_paquete vo_paquete = new cls_paquete(); cls_componentePaquete vo_componentePaquete = new cls_componentePaquete(); vo_entregable.pPK_entregable = Convert.ToInt32(row["PK_entregable"]); vo_componente.pPK_componente = Convert.ToInt32(row["PK_componente"]); vo_paquete.pPK_Paquete = Convert.ToInt32(row["PK_paquete"]); vo_paquete.pNombre = Convert.ToString(row["nombre"]); vo_componentePaquete.pEntregable = vo_entregable; vo_componentePaquete.pComponente = vo_componente; vo_componentePaquete.pPaquete = vo_paquete; //Si el elemento no se encuentra en la lista de memoria que mantiene los elementos que se obtienen de base de datos, se agrega if (cls_variablesSistema.vs_proyecto.pComponentePaqueteListaBaseDatos.Where(searchLinQ => searchLinQ.pPK_Paquete == vo_componentePaquete.pPK_Paquete).Count() == 0) { cls_variablesSistema.vs_proyecto.pComponentePaqueteListaBaseDatos.Add(vo_componentePaquete); } //Si el elemento no se encuentra asignado a la lista de memoria, se agrega if (cls_variablesSistema.vs_proyecto.pEntregableComponenteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Componente == vo_componentePaquete.pPK_Componente).Count() > 0) { if (cls_variablesSistema.vs_proyecto.pComponentePaqueteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Paquete == vo_componentePaquete.pPK_Paquete).Count() == 0) { cls_variablesSistema.vs_proyecto.pPaqueteLista.Add(vo_paquete); cls_variablesSistema.vs_proyecto.pComponentePaqueteListaMemoria.Add(vo_componentePaquete); } } } } //Se respetan los paquetes que hayan sido asignados en memoria if (cls_variablesSistema.vs_proyecto.pComponentePaqueteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Componente == po_componentePaquete.pPK_Componente).Count() > 0) { lbx_paqasociados.DataSource = cls_variablesSistema.vs_proyecto.pComponentePaqueteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Componente == po_componentePaquete.pPK_Componente); lbx_paqasociados.DataTextField = "pNombrePaquete"; lbx_paqasociados.DataValueField = "pPK_Paquete"; //Se realiza el Binding luego de saber de donde se tomarán los datos lbx_paqasociados.DataBind(); if (lbx_paqasociados.Items.Count > 0) { //Si se leyeron datos asociados, se activa el botón de siguiente btnNxt.Enabled = true; } } //Si el elemento no se encuentra en memoria, se realiza la consulta en base de datos else { vo_dataSet = cls_gestorComponentePaquete.selectComponentePaquete(po_componentePaquete); lbx_paqasociados.DataSource = vo_dataSet; lbx_paqasociados.DataTextField = "Nombre"; lbx_paqasociados.DataValueField = "PK_Paquete"; //Se realiza el Binding luego de saber de donde se tomarán los datos lbx_paqasociados.DataBind(); if (lbx_paqasociados.Items.Count > 0) { ListBox lbx_pivot = new ListBox(); lbx_pivot.DataSource = vo_dataSet; lbx_pivot.DataTextField = "Nombre"; lbx_pivot.DataValueField = "PK_Paquete"; lbx_pivot.DataBind(); foreach (ListItem item in lbx_pivot.Items) { if (cls_variablesSistema.vs_proyecto.pComponentePaqueteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Entregable == po_componentePaquete.pPK_Entregable && searchLinQ.pPK_Componente == po_componentePaquete.pPK_Componente && searchLinQ.pPK_Paquete == Convert.ToInt32(item.Value)).Count() == 0) { lbx_paqasociados.Items.Remove(item); } } //Si se leyeron datos asociados, se activa el botón de siguiente btnNxt.Enabled = true; } } } catch (Exception po_exception) { throw new Exception("Ocurrió un error al cargar los paquetes asociados al proyecto.", po_exception); } }
/// <summary> /// Se manda a cargar la totalidad de los actividades del proyecto /// </summary> private void cargarListaActividades() { try { /* NOta: * Revisar los selects de los listar, para ver que tanto es necesario cambiar los "pNombre" por los nombres de la tabla => "pNombre" - "pNombreActividad" * Ver si es relevante cambiar los nombres a los listbox */ lbx_actividades.DataSource = cls_gestorActividad.listarActividad(); lbx_actividades.DataTextField = "pNombre"; lbx_actividades.DataValueField = "pPK_actividad"; lbx_actividades.DataBind(); //Se valida dentro de la misma lista de actividades, que si en algunos de las actividades se encuentra asociada, que se encargue de eliminarlo //del listbox, para que no llegue a ser tomado en cuenta entre las actividades de algún otro paquete(son únicos por paquete) //Este listBox pivot se incorpora debido a que trabajar sobre el listbox original, por el manejo de punteros en C#, se presentan excepciones no controladas ListBox lbx_pivot = new ListBox(); lbx_pivot.DataSource = cls_gestorActividad.listarActividad(); lbx_pivot.DataTextField = "pNombre"; lbx_pivot.DataValueField = "pPK_actividad"; lbx_pivot.DataBind(); //Si se devuelven actividades asociadas, se remueven los mismos del listBox que mantiene la totalidad de actividades, estp para mantener la //pertenencia de una actividad a un sólo paquete if (lbx_actasociadas.Items.Count > 0) { foreach (ListItem item in lbx_actasociadas.Items) { lbx_actividades.Items.Remove(item); } } } catch (Exception po_exception) { throw new Exception("Ocurrió un error al cargar los datos de la lista de actividades del proyecto.", po_exception); } }
private void BindRolesInListBox(ListBox lst) { DataTable dtRoles = GetAllRoles(); lst.DataSource = dtRoles; lst.DataTextField = "RoleName"; lst.DataValueField = "RoleName"; lst.DataBind(); }
/// <summary> /// Render this control to the output parameter specified. /// </summary> /// <param name="output"> The HTML writer to write out to </param> protected override void Render(HtmlTextWriter output) { System.Web.HttpContext.Current.Trace.Warn("rendering datetime control!"); DateTimeFormatInfo dtInfo = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat; string daySelect = "--", monthSelect = "--", yearSelect = "--", hourSelect = "--", minuteSelect = "--"; if (_datetime.Year > 1900) { daySelect = _datetime.Day.ToString(); monthSelect = dtInfo.MonthNames[_datetime.Month-1]; yearSelect = _datetime.Year.ToString(); hourSelect = _datetime.Hour.ToString(); if (hourSelect.Length < 2) hourSelect = "0" + hourSelect; minuteSelect = markMinute(_datetime.Minute); } _months.Add("--"); for (int i=0;i<12;i++) { _months.Add(dtInfo.MonthNames[i]); } _years.Add("--"); for (int i=DateTime.Now.Year-_yearsBack; i<DateTime.Now.Year+20;i++) { _years.Add(i); } ListBox Days = new ListBox(); Days.SelectionMode = ListSelectionMode.Single; Days.Rows = 1; Days.ID = this.ID + "_days"; Days.DataSource = _days; try { Days.SelectedValue = daySelect; } catch { } Days.DataBind(); Days.Attributes.Add("onChange", "umbracoUpdateDatePicker('" + this.ClientID + "');"); ListBox Months = new ListBox(); Months.Attributes.Add("onChange", "umbracoUpdateDatePicker('" + this.ClientID + "');"); Months.SelectionMode = ListSelectionMode.Single; Months.Rows = 1; Months.ID = this.ID + "_months"; for (int i=0; i<_months.Count; i++) { ListItem li = new ListItem(_months[i].ToString(), (i).ToString()); Months.Items.Add(li); if (_months[i].ToString() == monthSelect.ToString()) Months.SelectedIndex = i; } ListBox Years = new ListBox(); Years.SelectionMode = ListSelectionMode.Single; Years.Rows = 1; Years.ID = this.ID + "_years"; Years.DataSource = _years; try { Years.SelectedValue = yearSelect; } catch {} Years.DataBind(); Years.Attributes.Add("onChange", "umbracoUpdateDatePicker('" + this.ClientID + "');"); ListBox Hours = new ListBox(); Hours.SelectionMode = ListSelectionMode.Single; Hours.Rows = 1; Hours.ID = this.ID + "_hours"; Hours.DataSource = _hours; try { Hours.SelectedValue = hourSelect; } catch {} Hours.DataBind(); Hours.Attributes.Add("onChange", "umbracoUpdateDatePicker('" + this.ClientID + "');"); ListBox Minutes = new ListBox(); Minutes.SelectionMode = ListSelectionMode.Single; Minutes.Rows = 1; Minutes.ID = this.ID + "_minutes"; // Copy minutes ArrayList minutesSource = new ArrayList(); foreach (string s in _minutes) if (s.Trim() != "") minutesSource.Add(s); minutesSource.Insert(0, "--"); Minutes.DataSource = minutesSource; try { Minutes.SelectedValue = minuteSelect; } catch {} Minutes.DataBind(); Minutes.Attributes.Add("onChange", "umbracoUpdateDatePicker('" + this.ClientID + "');"); // add in the format this.Controls.Add(Days); this.Controls.Add(new LiteralControl(" ")); this.Controls.Add(Months); this.Controls.Add(new LiteralControl(" ")); this.Controls.Add(Years); if (this.ShowTime) { this.Controls.Add(new LiteralControl(" ")); this.Controls.Add(Hours); this.Controls.Add(new LiteralControl(" : ")); this.Controls.Add(Minutes); } //this.Controls.Add(new LiteralControl(" <a href=\"#\"><img src=\"images/editor/calendar.gif\" alt=\"Pick a date\" class=\"clickImg\"/></a>")); base.RenderChildren(output); output.WriteLine("<input type=\"hidden\" id=\"" + this.ClientID + "\" name=\"" + this.ClientID + "\" value=\"" + _datetime.ToString() + "\"/>"); }
private void CreateDynamicControls() { productCat = db.ProductCategories.Where(x => x.Active == true).ToList(); string[] selectedItem = carItemsSelectedData.Value.Split(';'); List<CarItem> selectedCarItem = new List<CarItem>(); if (!string.IsNullOrEmpty(carItemsSelectedData.Value)) { for (int i = 0; i < selectedItem.Count(); i++) { string[] tmp = selectedItem[i].Split('|'); selectedCarItem.Add(new CarItem() { ProductCatID = Convert.ToInt32(tmp[0].Trim()), ProductID = tmp[1].Trim() }); } } foreach (var item in productCat) { Panel p = new Panel(); p.CssClass = "form-group"; p.ID = "p_" + item.ProductCatID; p.EnableViewState = true; Label l = new Label(); l.Text = item.ProductCatName.ToUpper(); ListBox lb = new ListBox(); lb.ID = "ddlCat" + item.ProductCatID; lb.SelectionMode = ListSelectionMode.Multiple; lb.EnableViewState = true; lb.CssClass = "form-control selectList"; lb.DataSource = db.Products.Where(x => x.Avtive == true && x.ProductCatID == item.ProductCatID).ToList(); lb.DataTextField = "ProductName"; lb.DataValueField = "ProductID"; p.Controls.Add(l); p.Controls.Add(new LiteralControl("<br />")); p.Controls.Add(lb); placehoder1.Controls.Add(p); lb.DataBind(); if (!string.IsNullOrEmpty(carItemsSelectedData.Value)) { foreach (var obj in selectedCarItem.Where(x => x.ProductCatID == item.ProductCatID)) { foreach (ListItem opt in lb.Items) { if (opt.Value == obj.ProductID) opt.Selected = true; } } } } }
protected void fillListBox(ListBox lst, DataSet ds, string textName, string valueName) { lst.DataSource = ds.Tables[0]; lst.DataTextField = textName; lst.DataValueField = valueName; lst.DataBind(); lst.Items.Insert(0, new ListItem("--Select--", "0")); }
public static bool LoadListBox(ListBox _listBox, object objData, string dataTextField, string dataValueField) { if (objData != null) { _listBox.DataSource = null; _listBox.Items.Clear(); _listBox.DataSource = objData; _listBox.DataTextField = dataTextField; _listBox.DataValueField = dataValueField; try { _listBox.DataBind(); } catch { return false; } return true; } return false; }
/// <summary> /// 数据集是List,绑定Name、Name /// </summary> /// <param name="lb">ListBox控件</param> /// <param name="items">List数据集</param> public static void FillListBox(ListBox lb, List<DropDownListItemObject> items) { List<DropDownListItemObject> newitems = new List<DropDownListItemObject>(); for (int i = 1; i <= items.Count; i++) { newitems.Insert(i, items[i - 1]); } lb.DataSource = items; lb.DataTextField = "Name"; lb.DataValueField = "Code"; lb.DataBind(); }
/// <summary> /// 填充LISTBOX控件数据 /// </summary> /// <param name="CuLB">当前ListBox控件</param> /// <param name="SqlStr">SQL语句</param> /// <param name="TableName">表名</param> /// <param name="TextField">要显示的字段</param> /// <param name="ValueField">数据字段</param> public static void Fill_ListBox(ListBox CuLB,string SqlStr,string TableName,string TextField,string ValueField) { SqlConnection _Conn=connection(); try { CuLB.DataSource=dataset_2(_Conn,SqlStr,TableName); CuLB.DataTextField = TextField; CuLB.DataValueField= ValueField; CuLB.DataBind(); } catch(Exception ex) { throw new Exception(ex.Message.ToString()); } finally { if(_Conn!=null) _Conn.Dispose(); } }
// ======================= // Dynamic Control.ID // ======================= // In order to catch these values the dynamically generated controls // needs to be re-generated at Page_Load. // The important thing is to assign the same ID to each control. // The ViewState uses the ID property of the Control objects to reinstate the values. // // ======================= // Page.IsPostBack // ======================= // We set the contrro//s tested member with a value // only at the first time the page is loaded // // private void Page_Load(object sender, EventArgs e) { HtmlForm form1 = (HtmlForm) (HtmlForm)this.FindControl("Form1"); this.GHTTestBegin(form1); this.GHTSubTestBegin("Check PostBack"); try { if (this.Page.IsPostBack) { this.GHTSubTestAddResult("PostBack Worked!!!"); } } catch (Exception exception49) { // ProjectData.SetProjectError(exception49); Exception exception1 = exception49; this.GHTSubTestAddResult("Unxpected " + exception1.GetType().Name + " exception was caught-" + exception1.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("AdRotator.KeywordFilter,Target"); try { AdRotator rotator1 = new AdRotator(); rotator1.ID = "objAdRotatorAll"; base.GHTActiveForm.Controls.Add(rotator1); if (!this.Page.IsPostBack) { rotator1.KeywordFilter = "test"; rotator1.Target = "_blank"; } else { this.GHTSubTestAddResult(rotator1.KeywordFilter); this.GHTSubTestAddResult(rotator1.Target); } } catch (Exception exception50) { // ProjectData.SetProjectError(exception50); Exception exception2 = exception50; this.GHTSubTestAddResult("Unxpected " + exception2.GetType().Name + " exception was caught-" + exception2.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); Label label1 = new Label(); this.GHTSubTestBegin("Style.BorderColor,BorderWidth,BorderStyle,CssClass,ForeColor,Height,Width,BackColor"); try { label1.ID = "objStyleLabelAll"; base.GHTActiveForm.Controls.Add(label1); if (!this.Page.IsPostBack) { label1.Style["BorderColor"] = "ffffff"; label1.Style["ForeColor"] = "ffffff"; label1.Style["BackColor"] = "ffffff"; label1.Style["BorderWidth"] = "2"; label1.Style["BorderStyle"] = "3"; label1.Style["CssClass"] = "CssClass"; label1.Style["Height"] = "2"; label1.Style["Width"] = "2"; } else { this.GHTSubTestAddResult(label1.Style["BorderColor"]); this.GHTSubTestAddResult(label1.Style["ForeColor"]); this.GHTSubTestAddResult(label1.Style["BackColor"]); this.GHTSubTestAddResult(label1.Style["BorderWidth"]); this.GHTSubTestAddResult(label1.Style["BorderStyle"]); this.GHTSubTestAddResult(label1.Style["CssClass"]); this.GHTSubTestAddResult(label1.Style["Height"]); this.GHTSubTestAddResult(label1.Style["Width"]); } } catch (Exception exception51) { // ProjectData.SetProjectError(exception51); Exception exception3 = exception51; this.GHTSubTestAddResult("Unxpected " + exception3.GetType().Name + " exception was caught-" + exception3.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("FontInfo.Underline,Italic,Names,Overline,Size,Strikeout,Bold"); try { if (!this.Page.IsPostBack) { label1.Font.Underline = true; label1.Font.Italic = true; label1.Font.Names.SetValue("myfont", 1); label1.Font.Overline = true; label1.Font.Size = FontUnit.Medium; label1.Font.Strikeout = true; label1.Font.Bold = true; } else { this.GHTSubTestAddResult(label1.Font.Underline.ToString()); this.GHTSubTestAddResult(label1.Font.Italic.ToString()); this.GHTSubTestAddResult((string)(label1.Font.Names.GetValue(1))); this.GHTSubTestAddResult(label1.Font.Overline.ToString()); this.GHTSubTestAddResult(label1.Font.Size.ToString()); this.GHTSubTestAddResult(label1.Font.Strikeout.ToString()); this.GHTSubTestAddResult(label1.Font.Bold.ToString()); } } catch (IndexOutOfRangeException exception52) { this.GHTSubTestAddResult("Test passed"); } this.GHTSubTestEnd(); this.GHTSubTestBegin("Control.Visible"); try { Button button1 = new Button(); button1.ID = "objControlAll"; base.GHTActiveForm.Controls.Add(button1); if (!this.Page.IsPostBack) { button1.Visible = false; } else { this.GHTSubTestAddResult(button1.Visible.ToString()); } } catch (Exception exception53) { // ProjectData.SetProjectError(exception53); Exception exception5 = exception53; this.GHTSubTestAddResult("Unxpected " + exception5.GetType().Name + " exception was caught-" + exception5.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("WebControl.AccessKey,Enabled,TabIndex,ToolTip"); try { Button button2 = new Button(); button2.ID = "objWebControlAll"; base.GHTActiveForm.Controls.Add(button2); if (!this.Page.IsPostBack) { button2.AccessKey = "F"; button2.Enabled = false; button2.TabIndex = 100; button2.ToolTip = "ToolTip"; } else { this.GHTSubTestAddResult(button2.AccessKey); this.GHTSubTestAddResult(button2.Enabled.ToString()); this.GHTSubTestAddResult(button2.TabIndex.ToString()); this.GHTSubTestAddResult(button2.ToolTip); } } catch (Exception exception54) { // ProjectData.SetProjectError(exception54); Exception exception6 = exception54; this.GHTSubTestAddResult("Unxpected " + exception6.GetType().Name + " exception was caught-" + exception6.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("Button.CausesValidation,CommandArgument,CommandName,Text"); try { Button button3 = new Button(); button3.ID = "objButtonAll"; base.GHTActiveForm.Controls.Add(button3); if (!this.Page.IsPostBack) { button3.CausesValidation = true; button3.CommandArgument = "test"; button3.CommandName = "test"; button3.Text = "test"; } else { this.GHTSubTestAddResult(button3.CausesValidation.ToString()); this.GHTSubTestAddResult(button3.CommandArgument); this.GHTSubTestAddResult(button3.CommandName); this.GHTSubTestAddResult(button3.Text); } } catch (Exception exception55) { // ProjectData.SetProjectError(exception55); Exception exception7 = exception55; this.GHTSubTestAddResult("Unxpected " + exception7.GetType().Name + " exception was caught-" + exception7.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); DataGrid grid1 = new DataGrid(); grid1.ID = "objDataGrid"; grid1.AutoGenerateColumns = false; BoundColumn column1 = new BoundColumn(); column1.HeaderText = "IntegerValue"; column1.DataField = "IntegerValue"; grid1.Columns.Add(column1); column1 = new BoundColumn(); column1.HeaderText = "StringValue"; column1.DataField = "StringValue"; grid1.Columns.Add(column1); column1 = new BoundColumn(); column1.HeaderText = "CurrencyValue"; column1.DataField = "CurrencyValue"; grid1.Columns.Add(column1); HyperLinkColumn column4 = new HyperLinkColumn(); column4.HeaderText = "objHyperLinkColumn"; grid1.Columns.Add(column4); ButtonColumn column2 = new ButtonColumn(); column2.HeaderText = "ButtonColumn"; grid1.Columns.Add(column2); EditCommandColumn column3 = new EditCommandColumn(); column3.HeaderText = "EditCommandColumn"; grid1.Columns.Add(column3); grid1.DataSource = this.CreateDataSource(); grid1.DataBind(); base.GHTActiveForm.Controls.Add(grid1); this.GHTSubTestBegin("BoundColumn.All"); try { column1 = (BoundColumn) grid1.Columns[2]; if (!this.Page.IsPostBack) { column1.DataFormatString = "{0:C}"; column1.ReadOnly = true; column1.DataField = "IntegerValue"; } else { this.GHTSubTestAddResult(column1.DataFormatString); this.GHTSubTestAddResult(column1.ReadOnly.ToString()); this.GHTSubTestAddResult(column1.DataField); } } catch (Exception exception56) { // ProjectData.SetProjectError(exception56); Exception exception8 = exception56; this.GHTSubTestAddResult("Unxpected " + exception8.GetType().Name + " exception was caught-" + exception8.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("HyperLinkColumn.All"); try { if (!this.Page.IsPostBack) { column4.Text = "test"; column4.DataNavigateUrlFormatString = "test.aspx?id={0}"; column4.Target = "_blank"; column4.NavigateUrl = "test"; column4.DataTextField = "StringValue"; column4.DataNavigateUrlField = "StringValue"; column4.DataTextFormatString = "{0:C}"; } else { this.GHTSubTestAddResult(column4.Text); this.GHTSubTestAddResult(column4.DataNavigateUrlFormatString); this.GHTSubTestAddResult(column4.Target); this.GHTSubTestAddResult(column4.NavigateUrl); this.GHTSubTestAddResult(column4.DataTextField); this.GHTSubTestAddResult(column4.DataNavigateUrlField); this.GHTSubTestAddResult(column4.DataTextFormatString); } } catch (Exception exception57) { // ProjectData.SetProjectError(exception57); Exception exception9 = exception57; this.GHTSubTestAddResult("Unxpected " + exception9.GetType().Name + " exception was caught-" + exception9.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("ButtonColumn.All"); try { column2 = (ButtonColumn) grid1.Columns[4]; if (!this.Page.IsPostBack) { column2.DataTextField = "StringValue"; //column2.ButtonType = (ButtonColumnType) "test"; column2.DataTextFormatString = "{0:C}"; } else { this.GHTSubTestAddResult(column2.DataTextField); this.GHTSubTestAddResult(((int) column2.ButtonType).ToString()); this.GHTSubTestAddResult(column2.DataTextFormatString); } } catch (Exception exception58) { // ProjectData.SetProjectError(exception58); Exception exception10 = exception58; this.GHTSubTestAddResult("Unxpected " + exception10.GetType().Name + " exception was caught-" + exception10.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("EditCommandColumn.All"); try { column3 = (EditCommandColumn) grid1.Columns[5]; if (!this.Page.IsPostBack) { column3.UpdateText = "test"; column3.CancelText = "test"; column3.EditText = "test"; column3.ButtonType = ButtonColumnType.PushButton; } else { this.GHTSubTestAddResult(column3.UpdateText); this.GHTSubTestAddResult(column3.CancelText); this.GHTSubTestAddResult(column3.EditText); this.GHTSubTestAddResult(((int) column3.ButtonType).ToString()); } } catch (Exception exception59) { // ProjectData.SetProjectError(exception59); Exception exception11 = exception59; this.GHTSubTestAddResult("Unxpected " + exception11.GetType().Name + " exception was caught-" + exception11.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("Calendar.All"); try { Calendar calendar1 = new Calendar(); calendar1.ID = "objCalendarAll"; base.GHTActiveForm.Controls.Add(calendar1); if (!this.Page.IsPostBack) { calendar1.ShowDayHeader = true; calendar1.FirstDayOfWeek = FirstDayOfWeek.Tuesday; calendar1.SelectWeekText = "SelectWeekText"; calendar1.CellSpacing = 4; calendar1.CellPadding = 6; calendar1.SelectMonthText = "SelectMonthText"; calendar1.VisibleDate = DateTime.Now; calendar1.DayNameFormat = DayNameFormat.FirstTwoLetters; calendar1.ShowGridLines = true; calendar1.TodaysDate = DateTime.Now.AddDays(1); calendar1.ShowNextPrevMonth = true; calendar1.ShowTitle = true; calendar1.TitleFormat = TitleFormat.MonthYear; calendar1.NextMonthText = "NextMonthText"; calendar1.NextPrevFormat = NextPrevFormat.FullMonth; calendar1.PrevMonthText = "PrevMonthText"; calendar1.SelectionMode = CalendarSelectionMode.DayWeekMonth; } else { this.GHTSubTestAddResult(calendar1.ShowDayHeader.ToString()); this.GHTSubTestAddResult(((int) calendar1.FirstDayOfWeek).ToString()); this.GHTSubTestAddResult(calendar1.SelectWeekText); this.GHTSubTestAddResult(calendar1.CellSpacing.ToString()); this.GHTSubTestAddResult(calendar1.CellPadding.ToString()); this.GHTSubTestAddResult(calendar1.SelectMonthText); this.GHTSubTestAddResult(calendar1.VisibleDate.ToString()); this.GHTSubTestAddResult(((int) calendar1.DayNameFormat).ToString()); this.GHTSubTestAddResult(calendar1.ShowGridLines.ToString()); this.GHTSubTestAddResult(calendar1.TodaysDate.ToString()); this.GHTSubTestAddResult(calendar1.ShowNextPrevMonth.ToString()); this.GHTSubTestAddResult(calendar1.ShowTitle.ToString()); this.GHTSubTestAddResult(((int) calendar1.TitleFormat).ToString()); this.GHTSubTestAddResult(calendar1.NextMonthText); this.GHTSubTestAddResult(((int) calendar1.NextPrevFormat).ToString()); this.GHTSubTestAddResult(calendar1.PrevMonthText); this.GHTSubTestAddResult(((int) calendar1.SelectionMode).ToString()); } } catch (Exception exception60) { // ProjectData.SetProjectError(exception60); Exception exception12 = exception60; this.GHTSubTestAddResult("Unxpected " + exception12.GetType().Name + " exception was caught-" + exception12.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("CheckBox.TextAlign,Text,Checked,AutoPostBack"); try { CheckBox box2 = new CheckBox(); box2.ID = "objCheckBoxAll"; base.GHTActiveForm.Controls.Add(box2); if (!this.Page.IsPostBack) { box2.TextAlign = TextAlign.Left; box2.Text = "test"; box2.Checked = true; box2.Checked = true; } else { this.GHTSubTestAddResult(((int) box2.TextAlign).ToString()); this.GHTSubTestAddResult(box2.Text); this.GHTSubTestAddResult(box2.Checked.ToString()); this.GHTSubTestAddResult(box2.Checked.ToString()); } } catch (Exception exception61) { // ProjectData.SetProjectError(exception61); Exception exception13 = exception61; this.GHTSubTestAddResult("Unxpected " + exception13.GetType().Name + " exception was caught-" + exception13.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("CheckBoxList.RepeatColumns"); try { CheckBoxList list1 = new CheckBoxList(); list1.ID = "objCheckBoxListRepeatColumns"; base.GHTActiveForm.Controls.Add(list1); if (!this.Page.IsPostBack) { list1.RepeatColumns = 2; } else { this.GHTSubTestAddResult(list1.RepeatColumns.ToString()); } } catch (Exception exception62) { // ProjectData.SetProjectError(exception62); Exception exception14 = exception62; this.GHTSubTestAddResult("Unxpected " + exception14.GetType().Name + " exception was caught-" + exception14.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("CheckBoxList.TextAlign"); try { CheckBoxList list2 = new CheckBoxList(); list2.ID = "objCheckBoxListTextAlign"; base.GHTActiveForm.Controls.Add(list2); if (!this.Page.IsPostBack) { list2.TextAlign = TextAlign.Right; } else { this.GHTSubTestAddResult(((int) list2.TextAlign).ToString()); } } catch (Exception exception63) { // ProjectData.SetProjectError(exception63); Exception exception15 = exception63; this.GHTSubTestAddResult("Unxpected " + exception15.GetType().Name + " exception was caught-" + exception15.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("CheckBoxList.RepeatDirection"); try { CheckBoxList list3 = new CheckBoxList(); list3.ID = "objCheckBoxListRepeatDirection"; base.GHTActiveForm.Controls.Add(list3); if (!this.Page.IsPostBack) { list3.RepeatDirection = RepeatDirection.Horizontal; } else { this.GHTSubTestAddResult(((int) list3.RepeatDirection).ToString()); } } catch (Exception exception64) { // ProjectData.SetProjectError(exception64); Exception exception16 = exception64; this.GHTSubTestAddResult("Unxpected " + exception16.GetType().Name + " exception was caught-" + exception16.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("CheckBoxList.RepeatLayout"); try { CheckBoxList list4 = new CheckBoxList(); list4.ID = "objCheckBoxListRepeatLayout"; base.GHTActiveForm.Controls.Add(list4); if (!this.Page.IsPostBack) { list4.RepeatLayout = RepeatLayout.Table; } else { this.GHTSubTestAddResult(((int) list4.RepeatLayout).ToString()); } } catch (Exception exception65) { // ProjectData.SetProjectError(exception65); Exception exception17 = exception65; this.GHTSubTestAddResult("Unxpected " + exception17.GetType().Name + " exception was caught-" + exception17.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); TextBox box1 = new TextBox(); box1.ID = "objControlToValidate"; base.GHTActiveForm.Controls.Add(box1); this.GHTSubTestBegin("CompareValidator.Operator"); try { CompareValidator validator1 = new CompareValidator(); validator1.ID = "objCompareValidatorOperator"; validator1.ControlToValidate = "objControlToValidate"; base.GHTActiveForm.Controls.Add(validator1); if (!this.Page.IsPostBack) { validator1.Operator = ValidationCompareOperator.GreaterThan; } else { this.GHTSubTestAddResult(((int) validator1.Operator).ToString()); } } catch (Exception exception66) { // ProjectData.SetProjectError(exception66); Exception exception18 = exception66; this.GHTSubTestAddResult("Unxpected " + exception18.GetType().Name + " exception was caught-" + exception18.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("CompareValidator.ControlToCompare"); try { CompareValidator validator2 = new CompareValidator(); validator2.ID = "objCompareValidatorControlToCompare"; validator2.ControlToValidate = "objControlToValidate"; base.GHTActiveForm.Controls.Add(validator2); if (!this.Page.IsPostBack) { validator2.ControlToValidate = "objControlToValidate"; } else { this.GHTSubTestAddResult(validator2.ControlToValidate); } } catch (Exception exception67) { // ProjectData.SetProjectError(exception67); Exception exception19 = exception67; this.GHTSubTestAddResult("Unxpected " + exception19.GetType().Name + " exception was caught-" + exception19.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("CompareValidator.ValueToCompare"); try { CompareValidator validator3 = new CompareValidator(); validator3.ID = "objCompareValidatorValueToCompare"; validator3.ControlToValidate = "objControlToValidate"; base.GHTActiveForm.Controls.Add(validator3); if (!this.Page.IsPostBack) { validator3.ValueToCompare = "test"; } else { this.GHTSubTestAddResult(validator3.ValueToCompare); } } catch (Exception exception68) { // ProjectData.SetProjectError(exception68); Exception exception20 = exception68; this.GHTSubTestAddResult("Unxpected " + exception20.GetType().Name + " exception was caught-" + exception20.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("HtmlButton.CausesValidation"); try { HtmlButton button4 = new HtmlButton(); button4.ID = "objHtmlButtonCausesValidation"; base.GHTActiveForm.Controls.Add(button4); if (!this.Page.IsPostBack) { button4.CausesValidation = true; } else { this.GHTSubTestAddResult(button4.CausesValidation.ToString()); } } catch (Exception exception69) { // ProjectData.SetProjectError(exception69); Exception exception21 = exception69; this.GHTSubTestAddResult("Unxpected " + exception21.GetType().Name + " exception was caught-" + exception21.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("HtmlInputImage.CausesValidation"); try { HtmlInputImage image1 = new HtmlInputImage(); image1.ID = "objHtmlInputImageCausesValidation"; base.GHTActiveForm.Controls.Add(image1); if (!this.Page.IsPostBack) { image1.CausesValidation = true; } else { this.GHTSubTestAddResult(image1.CausesValidation.ToString()); } } catch (Exception exception70) { // ProjectData.SetProjectError(exception70); Exception exception22 = exception70; this.GHTSubTestAddResult("Unxpected " + exception22.GetType().Name + " exception was caught-" + exception22.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("HtmlInputButton.CausesValidation"); try { HtmlInputButton button5 = new HtmlInputButton(); button5.ID = "objHtmlInputButtonCausesValidation"; base.GHTActiveForm.Controls.Add(button5); if (!this.Page.IsPostBack) { button5.CausesValidation = true; } else { this.GHTSubTestAddResult(button5.CausesValidation.ToString()); } } catch (Exception exception71) { // ProjectData.SetProjectError(exception71); Exception exception23 = exception71; this.GHTSubTestAddResult("Unxpected " + exception23.GetType().Name + " exception was caught-" + exception23.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("HyperLink.Text"); try { HyperLink link1 = new HyperLink(); link1.ID = "objHyperLinkText"; base.GHTActiveForm.Controls.Add(link1); if (!this.Page.IsPostBack) { link1.Text = "test"; } else { this.GHTSubTestAddResult(link1.Text); } } catch (Exception exception72) { // ProjectData.SetProjectError(exception72); Exception exception24 = exception72; this.GHTSubTestAddResult("Unxpected " + exception24.GetType().Name + " exception was caught-" + exception24.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("HyperLink.Target"); try { HyperLink link2 = new HyperLink(); link2.ID = "objHyperLinkTarget"; base.GHTActiveForm.Controls.Add(link2); if (!this.Page.IsPostBack) { link2.Target = "_blank"; } else { this.GHTSubTestAddResult(link2.Target); } } catch (Exception exception73) { // ProjectData.SetProjectError(exception73); Exception exception25 = exception73; this.GHTSubTestAddResult("Unxpected " + exception25.GetType().Name + " exception was caught-" + exception25.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("HyperLink.ImageUrl"); try { HyperLink link3 = new HyperLink(); link3.ID = "objHyperLinkImageUrl"; base.GHTActiveForm.Controls.Add(link3); if (!this.Page.IsPostBack) { link3.ImageUrl = "test"; } else { this.GHTSubTestAddResult(link3.ImageUrl); } } catch (Exception exception74) { // ProjectData.SetProjectError(exception74); Exception exception26 = exception74; this.GHTSubTestAddResult("Unxpected " + exception26.GetType().Name + " exception was caught-" + exception26.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("HyperLink.NavigateUrl"); try { HyperLink link4 = new HyperLink(); link4.ID = "objHyperLinkNavigateUrl"; base.GHTActiveForm.Controls.Add(link4); if (!this.Page.IsPostBack) { link4.NavigateUrl = "test"; } else { this.GHTSubTestAddResult(link4.NavigateUrl); } } catch (Exception exception75) { // ProjectData.SetProjectError(exception75); Exception exception27 = exception75; this.GHTSubTestAddResult("Unxpected " + exception27.GetType().Name + " exception was caught-" + exception27.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("Image.AlternateText"); try { Image image2 = new Image(); image2.ID = "objImageAlternateText"; base.GHTActiveForm.Controls.Add(image2); if (!this.Page.IsPostBack) { image2.AlternateText = "test"; } else { this.GHTSubTestAddResult(image2.AlternateText); } } catch (Exception exception76) { // ProjectData.SetProjectError(exception76); Exception exception28 = exception76; this.GHTSubTestAddResult("Unxpected " + exception28.GetType().Name + " exception was caught-" + exception28.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("Image.ImageAlign"); try { Image image3 = new Image(); image3.ID = "objImageImageAlign"; base.GHTActiveForm.Controls.Add(image3); if (!this.Page.IsPostBack) { image3.ImageAlign = ImageAlign.Right; } else { this.GHTSubTestAddResult(((int) image3.ImageAlign).ToString()); } } catch (Exception exception77) { // ProjectData.SetProjectError(exception77); Exception exception29 = exception77; this.GHTSubTestAddResult("Unxpected " + exception29.GetType().Name + " exception was caught-" + exception29.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("Image.ImageUrl"); try { Image image4 = new Image(); image4.ID = "objImageImageUrl"; base.GHTActiveForm.Controls.Add(image4); if (!this.Page.IsPostBack) { image4.ImageUrl = "test"; } else { this.GHTSubTestAddResult(image4.ImageUrl); } } catch (Exception exception78) { // ProjectData.SetProjectError(exception78); Exception exception30 = exception78; this.GHTSubTestAddResult("Unxpected " + exception30.GetType().Name + " exception was caught-" + exception30.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("ImageButton.CommandName"); try { ImageButton button6 = new ImageButton(); button6.ID = "objImageButtonCommandName"; base.GHTActiveForm.Controls.Add(button6); if (!this.Page.IsPostBack) { button6.CommandName = "test"; } else { this.GHTSubTestAddResult(button6.CommandName); } } catch (Exception exception79) { // ProjectData.SetProjectError(exception79); Exception exception31 = exception79; this.GHTSubTestAddResult("Unxpected " + exception31.GetType().Name + " exception was caught-" + exception31.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("ImageButton.CommandArgument"); try { ImageButton button7 = new ImageButton(); button7.ID = "objImageButtonCommandArgument"; base.GHTActiveForm.Controls.Add(button7); if (!this.Page.IsPostBack) { button7.CommandArgument = "test"; } else { this.GHTSubTestAddResult(button7.CommandArgument); } } catch (Exception exception80) { // ProjectData.SetProjectError(exception80); Exception exception32 = exception80; this.GHTSubTestAddResult("Unxpected " + exception32.GetType().Name + " exception was caught-" + exception32.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("ImageButton.CommandName"); try { ImageButton button8 = new ImageButton(); button8.ID = "objImageButtonCausesValidation"; base.GHTActiveForm.Controls.Add(button8); if (!this.Page.IsPostBack) { button8.CausesValidation = true; } else { this.GHTSubTestAddResult(button8.CausesValidation.ToString()); } } catch (Exception exception81) { // ProjectData.SetProjectError(exception81); Exception exception33 = exception81; this.GHTSubTestAddResult("Unxpected " + exception33.GetType().Name + " exception was caught-" + exception33.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("Label.Text"); try { Label label2 = new Label(); label2.ID = "objLabelText"; base.GHTActiveForm.Controls.Add(label2); if (!this.Page.IsPostBack) { label2.Text = "test"; } else { this.GHTSubTestAddResult(label2.Text); } } catch (Exception exception82) { // ProjectData.SetProjectError(exception82); Exception exception34 = exception82; this.GHTSubTestAddResult("Unxpected " + exception34.GetType().Name + " exception was caught-" + exception34.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("LinkButton.CausesValidation"); try { LinkButton button9 = new LinkButton(); button9.ID = "objLinkButtonCausesValidation"; base.GHTActiveForm.Controls.Add(button9); if (!this.Page.IsPostBack) { button9.CausesValidation = true; } else { this.GHTSubTestAddResult(button9.CausesValidation.ToString()); } } catch (Exception exception83) { // ProjectData.SetProjectError(exception83); Exception exception35 = exception83; this.GHTSubTestAddResult("Unxpected " + exception35.GetType().Name + " exception was caught-" + exception35.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("LinkButton.CommandName"); try { LinkButton button10 = new LinkButton(); button10.ID = "objLinkButtonCommandName"; base.GHTActiveForm.Controls.Add(button10); if (!this.Page.IsPostBack) { button10.CommandName = "test"; } else { this.GHTSubTestAddResult(button10.CommandName); } } catch (Exception exception84) { // ProjectData.SetProjectError(exception84); Exception exception36 = exception84; this.GHTSubTestAddResult("Unxpected " + exception36.GetType().Name + " exception was caught-" + exception36.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("LinkButton.CommandArgument"); try { LinkButton button11 = new LinkButton(); button11.ID = "objLinkButtonCommandArgument"; base.GHTActiveForm.Controls.Add(button11); if (!this.Page.IsPostBack) { button11.CommandArgument = "test"; } else { this.GHTSubTestAddResult(button11.CommandArgument); } } catch (Exception exception85) { // ProjectData.SetProjectError(exception85); Exception exception37 = exception85; this.GHTSubTestAddResult("Unxpected " + exception37.GetType().Name + " exception was caught-" + exception37.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("LinkButton.Text"); try { LinkButton button12 = new LinkButton(); button12.ID = "objLinkButtonText"; base.GHTActiveForm.Controls.Add(button12); if (!this.Page.IsPostBack) { button12.Text = "test"; } else { this.GHTSubTestAddResult(button12.Text); } } catch (Exception exception86) { // ProjectData.SetProjectError(exception86); Exception exception38 = exception86; this.GHTSubTestAddResult("Unxpected " + exception38.GetType().Name + " exception was caught-" + exception38.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("ListBox.All"); try { ListBox box3 = new ListBox(); box3.ID = "objListBoxAll"; base.GHTActiveForm.Controls.Add(box3); if (!this.Page.IsPostBack) { box3.SelectionMode = ListSelectionMode.Multiple; box3.Rows = 2; } else { this.GHTSubTestAddResult(((int) box3.SelectionMode).ToString()); this.GHTSubTestAddResult(box3.Rows.ToString()); } } catch (Exception exception87) { // ProjectData.SetProjectError(exception87); Exception exception39 = exception87; this.GHTSubTestAddResult("Unxpected " + exception39.GetType().Name + " exception was caught-" + exception39.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("ListControl.All"); try { ListBox box4 = new ListBox(); box4.ID = "objListControlAll"; box4.DataSource = this.CreateDataSource(); box4.DataBind(); base.GHTActiveForm.Controls.Add(box4); if (!this.Page.IsPostBack) { box4.AutoPostBack = true; box4.DataMember = "test"; box4.DataTextField = "StringValue"; box4.DataTextFormatString = "{0:C}"; box4.DataValueField = "StringValue"; } else { this.GHTSubTestAddResult(box4.AutoPostBack.ToString()); this.GHTSubTestAddResult(box4.DataMember); this.GHTSubTestAddResult(box4.DataTextField); this.GHTSubTestAddResult(box4.DataTextFormatString); this.GHTSubTestAddResult(box4.DataValueField); } } catch (Exception exception88) { // ProjectData.SetProjectError(exception88); Exception exception40 = exception88; this.GHTSubTestAddResult("Unxpected " + exception40.GetType().Name + " exception was caught-" + exception40.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("Literal.Text"); try { Literal literal1 = new Literal(); literal1.ID = "objLiteralText"; base.GHTActiveForm.Controls.Add(literal1); if (!this.Page.IsPostBack) { literal1.Text = "test"; } else { this.GHTSubTestAddResult(literal1.Text); } } catch (Exception exception89) { // ProjectData.SetProjectError(exception89); Exception exception41 = exception89; this.GHTSubTestAddResult("Unxpected " + exception41.GetType().Name + " exception was caught-" + exception41.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("Panel.All"); try { Panel panel1 = new Panel(); panel1.ID = "objPanelAll"; base.GHTActiveForm.Controls.Add(panel1); if (!this.Page.IsPostBack) { panel1.BackImageUrl = "test"; panel1.HorizontalAlign = HorizontalAlign.Right; panel1.Wrap = true; } else { this.GHTSubTestAddResult(panel1.BackImageUrl); this.GHTSubTestAddResult(((int) panel1.HorizontalAlign).ToString()); this.GHTSubTestAddResult(panel1.Wrap.ToString()); } } catch (Exception exception90) { // ProjectData.SetProjectError(exception90); Exception exception42 = exception90; this.GHTSubTestAddResult("Unxpected " + exception42.GetType().Name + " exception was caught-" + exception42.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("RadioButton.GroupName"); try { RadioButton button13 = new RadioButton(); button13.ID = "objRadioButtonGroupName"; base.GHTActiveForm.Controls.Add(button13); if (!this.Page.IsPostBack) { button13.GroupName = "test"; } else { this.GHTSubTestAddResult(button13.GroupName); } } catch (Exception exception91) { // ProjectData.SetProjectError(exception91); Exception exception43 = exception91; this.GHTSubTestAddResult("Unxpected " + exception43.GetType().Name + " exception was caught-" + exception43.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("RadioButtonList.RepeatColumns"); try { RadioButtonList list5 = new RadioButtonList(); list5.ID = "objRadioButtonListRepeatColumns"; base.GHTActiveForm.Controls.Add(list5); if (!this.Page.IsPostBack) { list5.RepeatColumns = 2; } else { this.GHTSubTestAddResult(list5.RepeatColumns.ToString()); } } catch (Exception exception92) { // ProjectData.SetProjectError(exception92); Exception exception44 = exception92; this.GHTSubTestAddResult("Unxpected " + exception44.GetType().Name + " exception was caught-" + exception44.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("RadioButtonList.RepeatDirection"); try { RadioButtonList list6 = new RadioButtonList(); list6.ID = "objRadioButtonListRepeatDirection"; base.GHTActiveForm.Controls.Add(list6); if (!this.Page.IsPostBack) { list6.RepeatDirection = RepeatDirection.Horizontal; } else { this.GHTSubTestAddResult(((int) list6.RepeatDirection).ToString()); } } catch (Exception exception93) { // ProjectData.SetProjectError(exception93); Exception exception45 = exception93; this.GHTSubTestAddResult("Unxpected " + exception45.GetType().Name + " exception was caught-" + exception45.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("RadioButtonList.TextAlign"); try { RadioButtonList list7 = new RadioButtonList(); list7.ID = "objRadioButtonListTextAlign"; base.GHTActiveForm.Controls.Add(list7); if (!this.Page.IsPostBack) { list7.TextAlign = TextAlign.Right; } else { this.GHTSubTestAddResult(((int) list7.TextAlign).ToString()); } } catch (Exception exception94) { // ProjectData.SetProjectError(exception94); Exception exception46 = exception94; this.GHTSubTestAddResult("Unxpected " + exception46.GetType().Name + " exception was caught-" + exception46.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("RadioButtonList.RepeatLayout"); try { RadioButtonList list8 = new RadioButtonList(); list8.ID = "objRadioButtonListRepeatLayout"; base.GHTActiveForm.Controls.Add(list8); if (!this.Page.IsPostBack) { list8.RepeatLayout = RepeatLayout.Flow; } else { this.GHTSubTestAddResult(((int) list8.RepeatLayout).ToString()); } } catch (Exception exception95) { // ProjectData.SetProjectError(exception95); Exception exception47 = exception95; this.GHTSubTestAddResult("Unxpected " + exception47.GetType().Name + " exception was caught-" + exception47.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTSubTestBegin("TextBox.ReadOnly,AutoPostBack,Columns,Wrap,Text,Rows,MaxLength,TextMode"); try { TextBox box5 = new TextBox(); box5.ID = "objTextBoxAll"; base.GHTActiveForm.Controls.Add(box5); if (!this.Page.IsPostBack) { box5.ReadOnly = true; box5.AutoPostBack = true; box5.Columns = 2; box5.Wrap = true; box5.Text = "test"; box5.Rows = 2; box5.MaxLength = 10; box5.TextMode = TextBoxMode.MultiLine; } else { this.GHTSubTestAddResult(box5.ReadOnly.ToString()); this.GHTSubTestAddResult(box5.ReadOnly.ToString()); this.GHTSubTestAddResult(box5.AutoPostBack.ToString()); this.GHTSubTestAddResult(box5.Columns.ToString()); this.GHTSubTestAddResult(box5.Wrap.ToString()); this.GHTSubTestAddResult(box5.Text); this.GHTSubTestAddResult(box5.Rows.ToString()); this.GHTSubTestAddResult(box5.MaxLength.ToString()); this.GHTSubTestAddResult(((int) box5.TextMode).ToString()); } } catch (Exception exception96) { // ProjectData.SetProjectError(exception96); Exception exception48 = exception96; this.GHTSubTestAddResult("Unxpected " + exception48.GetType().Name + " exception was caught-" + exception48.Message); // ProjectData.ClearProjectError(); } this.GHTSubTestEnd(); this.GHTTestEnd(); }
//----------------------------------------------------------------------------------------------------------------------------------- public static int lstBox_BindRefresh(bool showSel, bool ehBind, string XMLitem, ListBox _lstBox) { //Cria a Lista, carrega e destaca os ativos = 1... List<item> _lstData = setLista(showSel, XMLitem); if (ehBind) { _lstBox.DataSource = _lstData; _lstBox.DataValueField = "SEL"; _lstBox.DataTextField = "VALUE"; _lstBox.DataBind(); } // bool ehVAR = false; string strVAR = ""; string chkVAR = ""; int contAtivos = 0; for (int i = 0; i < _lstBox.Items.Count; i++) { for (int j = 0; j < _lstData.Count; j++) { strVAR = _lstData[j].VALUE; ehVAR = _lstBox.Items[i].ToString().Contains(strVAR); chkVAR = _lstData[j].CHK.ToString(); if ((ehVAR) && (chkVAR == "1")) { _lstBox.Items[i].Attributes.Add("style", "background-color: #90EE90"); contAtivos++; } } } //Retorna o numero de Ativos... return contAtivos; }
protected override void OnInit(EventArgs e) { base.OnInit(e); _Table = new Table(); _tableRow = new TableRow(); _tCellFirst = new TableCell {VerticalAlign = VerticalAlign.Top, Width = 260}; _tableRow.Cells.Add(_tCellFirst); _tCellSecond = new TableCell {VerticalAlign = VerticalAlign.Middle}; _tableRow.Cells.Add(_tCellSecond); _tCellThird = new TableCell {VerticalAlign = VerticalAlign.Top, Width = 260}; _tableRow.Cells.Add(_tCellThird); _Table.Rows.Add(_tableRow); var items = StoreHelper.GetAllCountries().Select(country => new ListItem(country.Name, country.Code)).OrderBy(x => x.Text).ToList(); var selectedItems = GetSelectedCountries().Select(country => new ListItem(country.Name, country.Code)).OrderBy(x => x.Text).ToList(); foreach (var selectedItem in selectedItems) { if (items.Contains(selectedItem)) { items.Remove(selectedItem); } } _lbAllItems = new ListBox {SelectionMode = ListSelectionMode.Multiple, Width = 250, Rows = 10}; foreach (var item in items) { _lbAllItems.Items.Add(new ListItem(item.Text, item.Value)); } _lbAllItems.DataBind(); var allItemsText = library.GetDictionaryItem("AllItems"); if (string.IsNullOrEmpty(allItemsText)) { allItemsText = "All items"; } _lblAllItems = new Label {Text = allItemsText, AssociatedControlID = _lbAllItems.ID}; var addText = library.GetDictionaryItem("Add"); if (string.IsNullOrEmpty(addText)) { addText = "Add"; } var removeText = library.GetDictionaryItem("Remove"); if (string.IsNullOrEmpty(removeText)) { removeText = "Remove"; } _tCellFirst.Controls.Add(_lblAllItems); _tCellFirst.Controls.Add(_lbAllItems); _btnMoveLeft = new Button {Text = removeText}; _btnMoveLeft.Click += BtnMoveLeftClick; _btnMoveRight = new Button {Text = addText}; _btnMoveRight.Click += BtnMoveRightClick; _tCellSecond.Controls.Add(_btnMoveLeft); _tCellSecond.Controls.Add(_btnMoveRight); _lbSelectedItems = new ListBox {SelectionMode = ListSelectionMode.Multiple, Width = 250, Rows = 10}; foreach (var selectedItem in selectedItems) { _lbSelectedItems.Items.Add(new ListItem(selectedItem.Text, selectedItem.Value)); } _lbSelectedItems.DataBind(); var selectedItemsText = library.GetDictionaryItem("SelectedItems"); if (string.IsNullOrEmpty(selectedItemsText)) { selectedItemsText = "Selected items"; } _lblSelectedItems = new Label {Text = selectedItemsText, AssociatedControlID = _lbSelectedItems.ID}; _tCellThird.Controls.Add(_lblSelectedItems); _tCellThird.Controls.Add(_lbSelectedItems); if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_Table); //if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_lblAllItems); //if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_lbAllItems); //if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_btnMoveLeft); //if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_btnMoveRight); //if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_lblSelectedItems); //if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_lbSelectedItems); }
public static void LbFill(ref ListBox lb, object list, bool appendFirstItem = false, ListFirstItemType firstItemType = ListFirstItemType.Nullable) { lb.Items.Clear(); bool appDatBouItems = lb.AppendDataBoundItems;//Запоминаем текущее значение, чтобы потом восстановить if (appendFirstItem) { lb.AppendDataBoundItems = true; ListItem li = new ListItem(); switch (firstItemType) { case ListFirstItemType.Nullable: li.Text = ddlEmptyText; li.Value = ddlEmptyValue; break; case ListFirstItemType.SelectAll: li.Text = ddlSelectAllText; li.Value = ddlSelectAllValue; break; } lb.Items.Add(li); } lb.DataTextField = listDefaultDataTextField; lb.DataValueField = listDefaultDataValueField; lb.DataSource = list; lb.DataBind(); if (appendFirstItem) { lb.AppendDataBoundItems = appDatBouItems;//Восстанавливаем запомненное значение } }
/// <summary> /// Método que carga las actividades para un paquete en específico /// </summary> /// <param name="po_paqueteActividad"></param> private void cargarActividadesPorPaquete(cls_paqueteActividad po_paqueteActividad) { DataSet vo_dataSet = new DataSet(); try { //Si se encuentran elementos en la lista de memoria, se verifica en estos if (cls_variablesSistema.vs_proyecto.pPaqueteActividadListaMemoria.Count == 0) { vo_dataSet = cls_gestorPaqueteActividad.selectPaqueteActividad(cls_variablesSistema.vs_proyecto); foreach (DataRow row in vo_dataSet.Tables[0].Rows) { cls_entregable vo_entregable = new cls_entregable(); cls_componente vo_componente = new cls_componente(); cls_paquete vo_paquete = new cls_paquete(); cls_actividad vo_actividad = new cls_actividad(); cls_paqueteActividad vo_paqueteActividad = new cls_paqueteActividad(); vo_entregable.pPK_entregable = Convert.ToInt32(row["PK_entregable"]); vo_componente.pPK_componente = Convert.ToInt32(row["PK_componente"]); vo_paquete.pPK_Paquete = Convert.ToInt32(row["PK_paquete"]); vo_actividad.pPK_Actividad = Convert.ToInt32(row["PK_actividad"]); vo_actividad.pNombre = Convert.ToString(row["nombre"]); vo_paqueteActividad.pEntregable = vo_entregable; vo_paqueteActividad.pComponente = vo_componente; vo_paqueteActividad.pPaquete = vo_paquete; vo_paqueteActividad.pActividad = vo_actividad; //Si en la lista de memoria que mantiene los objetos leídos a nivel de base de datos, no se encuentra el elemente, se agrega if (cls_variablesSistema.vs_proyecto.pPaqueteActividadListaBaseDatos.Where(searchLinQ => searchLinQ.pPK_Actividad == vo_paqueteActividad.pPK_Actividad).Count() == 0) { cls_variablesSistema.vs_proyecto.pPaqueteActividadListaBaseDatos.Add(vo_paqueteActividad); } //Si en la lista de memoria no se encuentra el elemento, se agrega if (cls_variablesSistema.vs_proyecto.pComponentePaqueteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Entregable == vo_paqueteActividad.pPK_Entregable && searchLinQ.pPK_Componente == vo_paqueteActividad.pPK_Componente && searchLinQ.pPK_Paquete == vo_paqueteActividad.pPK_Paquete).Count() > 0) { cls_variablesSistema.vs_proyecto.pActividadLista.Add(vo_actividad); cls_variablesSistema.vs_proyecto.pPaqueteActividadListaMemoria.Add(vo_paqueteActividad); } } } //Si el elemento se encuentra en la lista de memoria, se respeta para la asignación if (cls_variablesSistema.vs_proyecto.pPaqueteActividadListaMemoria.Where(searchLinQ => searchLinQ.pPK_Paquete == po_paqueteActividad.pPK_Paquete).Count() > 0) { lbx_actasociadas.DataSource = cls_variablesSistema.vs_proyecto.pPaqueteActividadListaMemoria.Where(searchLinQ => searchLinQ.pPK_Paquete == po_paqueteActividad.pPK_Paquete); lbx_actasociadas.DataTextField = "pNombreActividad"; lbx_actasociadas.DataValueField = "pPK_Actividad"; //Se realiza el Binding luego de saber de donde se tomarán los datos lbx_actasociadas.DataBind(); if (lbx_actasociadas.Items.Count > 0) { //Si se leyeron datos asociados, se activa el botón de siguiente btnNxt.Enabled = true; } } else { vo_dataSet = cls_gestorPaqueteActividad.selectPaqueteActividad(po_paqueteActividad); lbx_actasociadas.DataSource = vo_dataSet; lbx_actasociadas.DataTextField = "Nombre"; lbx_actasociadas.DataValueField = "PK_Actividad"; //Se realiza el Binding luego de saber de donde se tomarán los datos lbx_actasociadas.DataBind(); //Si se encuentran elementos asociados if (lbx_actasociadas.Items.Count > 0) { ListBox lbx_pivot = new ListBox(); lbx_pivot.DataSource = vo_dataSet; lbx_pivot.DataTextField = "Nombre"; lbx_pivot.DataValueField = "PK_Actividad"; lbx_pivot.DataBind(); //Si la actividad ya se encuentra asociada, se elimina del listbox de asociación foreach (ListItem item in lbx_pivot.Items) { if (cls_variablesSistema.vs_proyecto.pPaqueteActividadListaMemoria.Where(searchLinQ => searchLinQ.pPK_Entregable == po_paqueteActividad.pPK_Entregable && searchLinQ.pPK_Componente == po_paqueteActividad.pPK_Componente && searchLinQ.pPK_Paquete == po_paqueteActividad.pPK_Paquete && searchLinQ.pPK_Actividad == Convert.ToInt32(item.Value)).Count() == 0) { lbx_actasociadas.Items.Remove(item); } } } //Si se leyeron datos asociados, se activa el botón de siguiente btnNxt.Enabled = true; } } catch (Exception po_exception) { throw new Exception("Ocurrió un error al cargar los actividades asociadas al proyecto.", po_exception); } }
/// <summary> /// Método que obtiene los entregables asociados al entregable seleccionado /// </summary> /// <param name="po_entregableComponente"></param> private void cargarComponentesPorEntregable(cls_entregableComponente po_entregableComponente) { DataSet vo_dataSet = new DataSet(); try { //Si la lista de memoria se encuentra vacía, se realiza la consulta a nivel de base de datos if (((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto.pEntregableComponenteListaMemoria.Count == 0) { vo_dataSet = cls_gestorEntregableComponente.selectEntregableComponente(((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto); //Se recorren los registros obtenidos en la consulta foreach (DataRow row in vo_dataSet.Tables[0].Rows) { cls_entregable vo_entregable = new cls_entregable(); cls_componente vo_componente = new cls_componente(); cls_entregableComponente vo_entregableComponente = new cls_entregableComponente(); vo_entregable.pPK_entregable = Convert.ToInt32(row["PK_entregable"]); vo_componente.pPK_componente = Convert.ToInt32(row["PK_componente"]); vo_componente.pNombre = Convert.ToString(row["nombre"]); vo_entregableComponente.pEntregable = vo_entregable; vo_entregableComponente.pComponente = vo_componente; //Si el objeto no se encuentra en memoria, se agrega if (((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto.pEntregableComponenteListaBaseDatos.Where(searchLinQ => searchLinQ.pPK_Componente == vo_entregableComponente.pPK_Componente).Count() == 0) { ((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto.pEntregableComponenteListaBaseDatos.Add(vo_entregableComponente); } //Si el objeto no se encuentra en memoria, se agrega if (((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto.pProyectoEntregableListaMemoria.Where(searchLinQ => searchLinQ.pPK_Entregable == vo_entregableComponente.pPK_Entregable).Count() > 0) { if (((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto.pEntregableComponenteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Componente == vo_entregableComponente.pPK_Componente).Count() == 0) { ((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto.pComponenteLista.Add(vo_componente); ((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto.pEntregableComponenteListaMemoria.Add(vo_entregableComponente); } } } } //Si el objeto está asociado en memoria se utiliza if (((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto.pEntregableComponenteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Entregable == po_entregableComponente.pPK_Entregable).Count() > 0) { lbx_compasociados.DataSource = ((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto.pEntregableComponenteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Entregable == po_entregableComponente.pPK_Entregable); lbx_compasociados.DataTextField = "pNombreComponente"; lbx_compasociados.DataValueField = "pPK_Componente"; //Se realiza el Binding luego de saber de donde se tomarán los datos lbx_compasociados.DataBind(); if (lbx_compasociados.Items.Count > 0) { //Si se leyeron datos asociados, se activa el botón de siguiente btnNxt.Enabled = true; } } //De lo contrario se consulta en base de datos para obtener, si existen, los registros asociados else { vo_dataSet = cls_gestorEntregableComponente.selectEntregableComponente(po_entregableComponente); lbx_compasociados.DataSource = vo_dataSet; lbx_compasociados.DataTextField = "Nombre"; lbx_compasociados.DataValueField = "PK_Componente"; //Se realiza el Binding luego de saber de donde se tomarán los datos lbx_compasociados.DataBind(); if (lbx_compasociados.Items.Count > 0) { ListBox lbx_pivot = new ListBox(); lbx_pivot.DataSource = vo_dataSet; lbx_pivot.DataTextField = "Nombre"; lbx_pivot.DataValueField = "PK_Componente"; lbx_pivot.DataBind(); foreach (ListItem item in lbx_pivot.Items) { if (((CSLA.web.App_Variables.cls_variablesSistema)this.Session[CSLA.web.App_Constantes.cls_constantes.VARIABLES]).vs_proyecto.pEntregableComponenteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Entregable == po_entregableComponente.pPK_Entregable && searchLinQ.pPK_Componente == Convert.ToInt32(item.Value)).Count() == 0) { lbx_compasociados.Items.Remove(item); } } //Si se leyeron datos asociados, se activa el botón de siguiente btnNxt.Enabled = true; } } } catch (Exception po_exception) { throw new Exception("Ocurrió un error al cargar los entregables asociados al proyecto.", po_exception); } }
/// <summary> /// Se manda a cargar la totalidad de los paquetes del proyecto /// </summary> private void cargarListaPaquetes() { try { /* NOta: * Revisar los selects de los listar, para ver que tanto es necesario cambiar los "pNombre" por los nombres de la tabla => "pNombre" - "pNombrePaquete" * Ver si es relevante cambiar los nombres a los listbox */ lbx_paquetes.DataSource = cls_gestorPaquete.listarPaquetes(); lbx_paquetes.DataTextField = "pNombre"; lbx_paquetes.DataValueField = "pPK_paquete"; lbx_paquetes.DataBind(); //Se valida dentro de la misma lista de paquetes, que si en algunos de los componentes se encuentra asociado, que se encargue de eliminarlo //del listbox, para que no llegue a ser tomado en cuenta entre los paquetes de algún otro componente(son únicos por componente) //Este listBox pivot se incorpora debido a que trabajar sobre el listbox original, por el manejo de punteros en C#, se presentan excepciones no controladas ListBox lbx_pivot = new ListBox(); lbx_pivot.DataSource = cls_gestorPaquete.listarPaquetes(); lbx_pivot.DataTextField = "pNombre"; lbx_pivot.DataValueField = "pPK_paquete"; lbx_pivot.DataBind(); //Si se devuelven paquetes asociados, se remueven los mismos del listBox que mantiene la totalidad de paquetes, estp para mantener la //pertenencia de un paquetes a un sólo componente if (lbx_paqasociados.Items.Count > 0) { foreach (ListItem item in lbx_paqasociados.Items) { lbx_paquetes.Items.Remove(item); } } //También se procede a eliminar de la lista de paquetes aquellos que se encuentren asignados en memoria foreach (ListItem item in lbx_pivot.Items) { if (cls_variablesSistema.vs_proyecto.pComponentePaqueteListaMemoria.Where(searchLinQ => searchLinQ.pPK_Paquete.ToString() == item.Value).Count() > 0) { lbx_paquetes.Items.Remove(item); } } } catch (Exception po_exception) { throw new Exception("Ocurrió un error al cargar los datos de la lista de paquetes del proyecto.", po_exception); } }
private void BindRolesInListBox(ListBox lst) { try { DataTable dtRoles = GetAllRoles(); lst.DataSource = dtRoles; lst.DataTextField = "RoleName"; lst.DataValueField = "RoleID"; lst.DataBind(); } catch (Exception ex) { ProcessException(ex); } }
public void AddSelectList(string name, string label, int[] values, int span, int rows, string idMember, string textMember, IList source) { this.AddEditLabel(label, span); ListBox listBox = new ListBox(); listBox.ID = name; listBox.SelectionMode = ListSelectionMode.Multiple; listBox.Rows = rows; listBox.DataValueField = idMember; listBox.DataTextField = textMember; listBox.DataSource = source; listBox.DataBind(); foreach (int value in values) { listBox.Items.FindByValue(value.ToString()).Selected = true; } this.editView.Controls.Add(listBox); this.EndCurrent(span); if (this.editView.focusControl == null) this.editView.focusControl = listBox; }
public static void BindToListBox(ListBox ddlID, string selectValue) { Model.SelectRecord selectRecord = new Model.SelectRecord { Irecord = "", Scolumnlist = "ID,Name", Stablename = "Organizational", Scondition = "where PID='0'" }; DataTable table = BLL.SelectRecord.SelectRecordData(selectRecord).Tables[0]; if ((table != null) && (table.Rows.Count != 0)) { for (int i = 0; i < table.Rows.Count; i++) { ListItem item6 = new ListItem { Value = table.Rows[i]["ID"].ToString(), Text = table.Rows[i]["Name"].ToString() }; ListItem item = item6; ddlID.Items.Add(item); selectRecord.Scondition = "where PID='" + item.Value + "'"; DataTable table2 = BLL.SelectRecord.SelectRecordData(selectRecord).Tables[0]; if ((table2 != null) && (table2.Rows.Count != 0)) { for (int j = 0; j < table2.Rows.Count; j++) { ListItem item5 = new ListItem { Value = table2.Rows[j]["ID"].ToString(), Text = " " + table2.Rows[j]["Name"].ToString() }; ListItem item2 = item5; ddlID.Items.Add(item2); selectRecord.Scondition = "where PID='" + item2.Value + "'"; DataTable table3 = BLL.SelectRecord.SelectRecordData(selectRecord).Tables[0]; if ((table3 != null) && (table3.Rows.Count != 0)) { for (int k = 0; k < table3.Rows.Count; k++) { ListItem item4 = new ListItem { Value = table3.Rows[k]["ID"].ToString(), Text = " " + table3.Rows[k]["Name"].ToString() }; ListItem item3 = item4; ddlID.Items.Add(item3); } table3.Clear(); table3.Dispose(); } } table2.Clear(); table2.Dispose(); } } table.Clear(); table.Dispose(); } ddlID.DataBind(); if (selectValue != null && selectValue != "") { string[] s = selectValue.Split(new char[] { ',' }); for (int i = 0; i < s.Length; i++) { for (int j = 0; j < ddlID.Items.Count; j++) { if (ddlID.Items[j].Value == s[i]) { ddlID.Items[j].Selected = true; } } } } }