aspx_espanol thread: IDAEL AYUDA! Un DropDonwList, ligado a un data set para modificar un datagrid
Alberto Alejandro <aa_theone@y...> wrote:
Oye Idael, implemente el llenado del datasource a un dropdownlist, usando las funciones de llenado y tambien la de seleccion de
algun elemento del mismo.
Me funciono en un datagrid.
Me perfile a utilizar esta metodologia en un segundo datagrid.
Y no me funciona me indica
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 628:Line 629: Dim dt As DataTable = DSet_Embeded.Tables(Tabla)Line 630: For iLoop = 0 To dt.Rows.Count - 1Line
631: If Int16.Parse(LookID) = Int16.Parse(dt.Rows(iLoop)("IDdimension")) ThenLine 632: Return iLoop
Pero lo mas raro es que ya no funciona tampoco para el primer datagrid que si me funciono.
Que me habra pasado (bueno a mi no, a mi aplicacion).
Function Busca_Preseleccion_Descripcion(ByVal LookID As String, ByVal Tabla As String) As Integer
Dim iLoop As Integer
Dim dt As DataTable = DSet_Embeded.Tables(Tabla)
For iLoop = 0 To dt.Rows.Count - 1
If Int16.Parse(LookID) = Int16.Parse(dt.Rows(iLoop)("IDdescripcion")) Then
Return iLoop
End If
Next iLoop
End Function
Function GetDescripcion() As DataSet
Dim strSQLDDL As String = "SELECT Descripcion, IDDescIndicador FROM DescIndicadores where Iddirector =14 ORDER BY DescIndicadores"
Dim myDataAdapter As SqlDataAdapter = New SqlDataAdapter(strSQLDDL, Conexion)
DSet_Embeded.Reset()
myDataAdapter.Fill(DSet_Embeded, "DescIndicadores")
Return DSet_Embeded
End Function
Dim DSet_Embeded As DataSet = New DataSet()
<asp:TemplateColumn HeaderText="Indicador">
<ItemTemplate>
<asp:Label id=Label5 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Descripcion") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList id=Em_DDL_Descripcion runat="server" Width="120px" DataValueField="IDDescIndicador"
DataTextField="Descripcion" SelectedIndex='<%#
Busca_Preseleccion_Descripcion(Container.DataItem("IDDescIndicador"),"DescIndicadores") %>' DataSource="<%# GetDescripcion()
%>">
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
---------------------------------
Do You Yahoo!?
Yahoo! Net: La mejor conexión a internet y 25MB extra a tu correo por $100 al mes.