-
Notifications
You must be signed in to change notification settings - Fork 0
/
combocs
119 lines (103 loc) · 3.23 KB
/
combocs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace ControlFI.Web.Formularios.UserControls
{
public partial class ComboBox : System.Web.UI.UserControl
{
public event EventHandler SelectedIndexChanged;
private bool Normalizar;
protected void Page_Load(object sender, EventArgs e)
{
ListaItems.Rows = 6;
Normalizar = false;
ListaItems.Visible = true;
}
public void CargaLista(DataTable Datos, string Campo)
{
ListaItems.DataSource = Datos;
ListaItems.DataTextField = Campo;
ListaItems.DataBind();
ListaItems_DataBound();
}
public void CargaLista(DataTable Datos, string Campo, string Valor )
{
ListaItems.DataSource = Datos;
ListaItems.DataTextField = Campo;
ListaItems.DataValueField = Valor;
ListaItems.DataBind();
ListaItems_DataBound();
}
public void CargaLista(Dictionary<int, string> Datos, string Campo, string Valor)
{
// Revisar posible error
ListaItems.DataSource = Datos;
ListaItems.DataTextField = Campo;
ListaItems.DataValueField = Valor;
ListaItems.DataBind();
ListaItems_DataBound();
}
public void MarcarAnterior(int indice, System.Drawing.Color color)
{
ListaItems.Items[indice].Attributes.Add("style", "background-color:" + color);
}
public void Deshabilitar()
{
TextBox1.Enabled = false;
DdeCombo.Enabled = false;
ItemsDiv.Visible = false;
}
public void Habilitar()
{
TextBox1.Enabled = true;
DdeCombo.Enabled = true;
ItemsDiv.Visible = true;
}
protected void ListaItems_SelectedIndexChanged(object sender, EventArgs e)
{
EventHandler handler = SelectedIndexChanged;
if (handler != null) handler(this, e);
}
public string DefaultText
{
get { return TextBox1.Text; }
set { TextBox1.Text = value; }
}
public object SelectedItem
{
get { return ListaItems.SelectedItem.Value; }
}
public int SelectedIndex
{
get { return ListaItems.SelectedIndex; }
set { ListaItems.SelectedIndex = value; }
}
public string SelectedValue
{
get { return ListaItems.SelectedValue; }
}
public int ShowItems
{
get { return ListaItems.Rows; }
set { ListaItems.Rows = value; }
}
public bool NormalizarTexto
{
set { Normalizar = value; }
}
protected void ListaItems_DataBound()
{
if (Normalizar)
{
foreach (ListItem item in ListaItems.Items)
{
item.Text = Utiles.Utiles.UppercaseFirst(item.Text);
}
}
}
}
}