
selected value de un DropDownList dentro de un gridview
Publicado por jose manuel (5 intervenciones) el 20/07/2016 00:25:49
Espero me puedan ayudar, al llenar un DropDownList dentro de un grid view este se ejecuta bien, pero ahora necesito que al finalizar cada linea este DropDownList tenga su valor asignado desde una tabla el DropDownList puede venir con 4 campos por decirlo asi oaxaca, leon, merida y quiero que al llenar el grid cada DropDownList este seleccionado su valor por linea
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
protected void gridTrenes_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//Find the DropDownList in the Row
// DropDownList ddlCountries = (e.Row.FindControl("drpDestinos") as DropDownList);
DropDownList ddlCountries = (DropDownList)e.Row.FindControl("drpDestinos");
TextBox Llegada = (e.Row.FindControl("txtLlegadaGrid") as TextBox);
TextBox Liberacion = (e.Row.FindControl("txtLiberacionGrid") as TextBox);
TextBox Salida = (e.Row.FindControl("txtSalidaGrid") as TextBox);
Button Guardar = (e.Row.FindControl("GuardarGridBtn") as Button);
drpDestinos.DataSource = SIPP.DataBase.GetTable("despachos.dbo.sp_OrigenesGet");
drpDestinos.DataTextField = "descripcion";
drpDestinos.DataValueField = "Origen";
drpDestinos.DataBind();
if (Liberacion.Text != "" && Salida.Text !="")
{
ddlCountries.Enabled = false;
Guardar.Enabled = false;
Llegada.Enabled = false;
Liberacion.Enabled = false;
Salida.Enabled = false;
}
}
}
Valora esta pregunta


0