A
Antonio D'Ottavio
Good Morning,
In my web page I've a datalist that is sourced by a database,
the problem is that I want that one of the column of the datalist contain a
dropdownbox
that also is sourced by a table in the database.
The problem is is the error :
System.NullReferenceException: Reference to an Object not setted on a
object instance
It is on the istruction
"ComboTipoPartita_DDL.DataSource=dsCampi.Tables["TipoPartita"];" of the
following function :
void BindComboTipoPartita(Object sender, DataListItemEventArgs e)
{
dsCampi.Tables.Add("TipoPartita");
OleDbDataAdapter daTipoPartita = new OleDbDataAdapter("SELECT
IDTipoPartita, DescrizioneTipoPartita from TipoPartita" ,OleDbconn);
daTipoPartita.Fill(dsCampi,"TipoPartita");
DropDownList ComboTipoPartita_DDL =
(DropDownList)e.Item.FindControl("ComboTipoPartita");
ComboTipoPartita_DDL.DataSource=dsCampi.Tables["TipoPartita"];
ComboTipoPartita_DDL.DataBind();
}
and this is the datalist I defined :
<ASPataList id="MyDataCampi" runat="server" ...
OnItemDataBound="BindComboTipoPartita" >
<HeaderTemplate>
<table width="100%" style="font: 8pt verdana">
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:CCFF99">
<td>
<aspropDownList id="ComboTipoPartita" runat="server"
DataValueField="IDTipoPartita"
DataTextField="DescrizioneTipoPartita"
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</ASPataList>
Have you any idea to solve the problem ???
Thanks ....
Antonio D'Ottavio
www.etantonio.it/en
In my web page I've a datalist that is sourced by a database,
the problem is that I want that one of the column of the datalist contain a
dropdownbox
that also is sourced by a table in the database.
The problem is is the error :
System.NullReferenceException: Reference to an Object not setted on a
object instance
It is on the istruction
"ComboTipoPartita_DDL.DataSource=dsCampi.Tables["TipoPartita"];" of the
following function :
void BindComboTipoPartita(Object sender, DataListItemEventArgs e)
{
dsCampi.Tables.Add("TipoPartita");
OleDbDataAdapter daTipoPartita = new OleDbDataAdapter("SELECT
IDTipoPartita, DescrizioneTipoPartita from TipoPartita" ,OleDbconn);
daTipoPartita.Fill(dsCampi,"TipoPartita");
DropDownList ComboTipoPartita_DDL =
(DropDownList)e.Item.FindControl("ComboTipoPartita");
ComboTipoPartita_DDL.DataSource=dsCampi.Tables["TipoPartita"];
ComboTipoPartita_DDL.DataBind();
}
and this is the datalist I defined :
<ASPataList id="MyDataCampi" runat="server" ...
OnItemDataBound="BindComboTipoPartita" >
<HeaderTemplate>
<table width="100%" style="font: 8pt verdana">
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:CCFF99">
<td>
<aspropDownList id="ComboTipoPartita" runat="server"
DataValueField="IDTipoPartita"
DataTextField="DescrizioneTipoPartita"
</td></aspropDownList>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</ASPataList>
Have you any idea to solve the problem ???
Thanks ....
Antonio D'Ottavio
www.etantonio.it/en