Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   .NET (http://www.forosdelweb.com/f29/)
-   -   dropdownlist en datagrid (http://www.forosdelweb.com/f29/dropdownlist-datagrid-249931/)

jhernanp 25/11/2004 15:22

dropdownlist en datagrid
 
Hola tendo datagrid con un dropDownlist dentro de un datagrid con las opciones aprobar, rechazar.

No se como hacer para que el usuario seleccione la opcion para cada registro del datagrid y despues con un boton que esta por fuera grabar las modificaciones en la base de datos.

edwargu 25/11/2004 17:12

has probado con la siguiente funcion:
CType(dgp.Items(p).FindControl("dg"), DataGrid).DataSource = ds

splinter 25/11/2004 18:33

Hola, te paso un ejemplo
Private Sub Grid_BomFindingEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Grid_BomFindingEdit.SelectedIndexChanged
...
...
EC_Number = CType(Grid_BomFindingEdit.SelectedItem.FindControl ("TxtEC_No"), TextBox).Text
Root_Cause = CType(Grid_BomFindingEdit.SelectedItem.Cells(10).F indControl("LstRC"), DropDownList).SelectedValue
...
...
...

end sub

Saludos

jhernanp 26/11/2004 09:41

He tratado de utilizar este codigo pero no me es claro podrias explicarme mas detalladamente lo que tengo que hacer.

splinter 26/11/2004 15:06

OK, usando un boton de update, el grid se activa para edicion. Tratare de explicarme con este ejemplo, donde el grid contiene una lista y un control textbox


'EVENTO DEL GRID PARA ACTUALIZAR (UPDATE)
Private Sub GridDatos_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles GridDatos.UpdateCommand
Dim value1 As String
Dim ValLista as string
'AQUI SE OBTIENE EL VALOR DEL CONTROL TEXTBOX
value1 = (CType(e.Item.FindControl("txtValueID"), TextBox).Text)
'AQUI SE OBTIENE EL VALOR DEL ELEMENTO LA LISTA SELECCIONADA,
'SE BUSCA EN LA COLUMNA(10) EL VALOR DEL ELEMENTO DEL CONTROL ("LstRC") QUE ES UNA LISTA, SE CONVIERTE AL TIPO LISTA Y SE OBTIENE SU VALOR (SELECTVALUE)

ValLista = CType(GridDatos.SelectedItem.Cells(10).FindControl
("LstRC"), DropDownList).SelectedValue

'...sentencias

End Sub


La zona horaria es GMT -6. Ahora son las 08:26.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.