Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datalist insite a datalist edit item

Status
Not open for further replies.

hlybbi

Programmer
Mar 19, 2003
91
IS
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">
<asp:DropDownList id="Dropdownlist3" runat="server"></asp:DropDownList>
</td>
</tr>
</table>
<!-- -->
<asp:DataList
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>

</asp:DataList>
<!-- -->
</ItemTemplate>
</asp:datalist>



Best regards Hlynur
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top