i am having problem with datalist insite a nother datalist
i have a button insite the sub datalist and a record i need to edit inn EditItemTemplate
and when i try to use this code i get an error
Object reference not set to an instance of an object
does anybody know what i need to do
public void Edit_Command(Object sender, DataListCommandEventArgs e)
{
CountryList.EditItemIndex = e.Item.ItemIndex;
CountryListFill();
}
<asp:datalist id="ContinentsList" runat="server" RepeatDirection="Horizontal" width="100%" RepeatColumns="3">
<ItemStyle VerticalAlign="Top" BorderWidth="1px" BorderColor="Silver"></ItemStyle>
<ItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<b>
<%# DataBinder.Eval(Container.DataItem, "Nafn") %>
</b>
</td>
<td align="right">
<aspropDownList id="Dropdownlist3" runat="server"></aspropDownList>
</td>
</tr>
</table>
<!-- -->
<aspataList
VerticalAlign="Top"
id="CountryList"
runat="server"
width="100%"
datasource='<%# DataBinder.Eval(Container, "DataItem.CountryRelation") %>'
OnUpdateCommand="Update_Command"
OnEditCommand="Edit_Command">
<AlternatingItemStyle BackColor="Silver"></AlternatingItemStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedItemStyle>
<ItemStyle VerticalAlign="Top" BackColor="white"></ItemStyle>
<ItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<asp:LinkButton id="EditButton" Text='<%# DataBinder.Eval(Container.DataItem, "countryname") %>' CommandName="Edit" runat="server"/>
</td>
<td align="right">
<asp:LinkButton id="EditButton2" Text='<%# DataBinder.Eval(Container.DataItem, "test") %>' CommandName="Edit" runat="server"/>
</td>
</tr>
</table>
</ItemTemplate>
<EditItemStyle BackColor="yellow"></EditItemStyle>
<EditItemTemplate>
Edit country
gfdgfdg
gfdgdf
g****************
***************
****************
**************
<asp:LinkButton id="UpdateButton" Text="Update" CommandName="Update" runat="server" />
</EditItemTemplate>
</aspataList>
<!-- -->
</ItemTemplate>
</asp:datalist>
Best regards Hlynur
i have a button insite the sub datalist and a record i need to edit inn EditItemTemplate
and when i try to use this code i get an error
Object reference not set to an instance of an object
does anybody know what i need to do
public void Edit_Command(Object sender, DataListCommandEventArgs e)
{
CountryList.EditItemIndex = e.Item.ItemIndex;
CountryListFill();
}
<asp:datalist id="ContinentsList" runat="server" RepeatDirection="Horizontal" width="100%" RepeatColumns="3">
<ItemStyle VerticalAlign="Top" BorderWidth="1px" BorderColor="Silver"></ItemStyle>
<ItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<b>
<%# DataBinder.Eval(Container.DataItem, "Nafn") %>
</b>
</td>
<td align="right">
<aspropDownList id="Dropdownlist3" runat="server"></aspropDownList>
</td>
</tr>
</table>
<!-- -->
<aspataList
VerticalAlign="Top"
id="CountryList"
runat="server"
width="100%"
datasource='<%# DataBinder.Eval(Container, "DataItem.CountryRelation") %>'
OnUpdateCommand="Update_Command"
OnEditCommand="Edit_Command">
<AlternatingItemStyle BackColor="Silver"></AlternatingItemStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedItemStyle>
<ItemStyle VerticalAlign="Top" BackColor="white"></ItemStyle>
<ItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<asp:LinkButton id="EditButton" Text='<%# DataBinder.Eval(Container.DataItem, "countryname") %>' CommandName="Edit" runat="server"/>
</td>
<td align="right">
<asp:LinkButton id="EditButton2" Text='<%# DataBinder.Eval(Container.DataItem, "test") %>' CommandName="Edit" runat="server"/>
</td>
</tr>
</table>
</ItemTemplate>
<EditItemStyle BackColor="yellow"></EditItemStyle>
<EditItemTemplate>
Edit country
gfdgfdg
gfdgdf
g****************
***************
****************
**************
<asp:LinkButton id="UpdateButton" Text="Update" CommandName="Update" runat="server" />
</EditItemTemplate>
</aspataList>
<!-- -->
</ItemTemplate>
</asp:datalist>
Best regards Hlynur