Urgent VB.net datalist control items in edit template
Hi guys,
Im using vb.net and working with a datalist.
I have labels, textboxes dropdownlist in the main item template.
I also have labels, textboxes dropdownlist in the edit template
which means when i click the edit button from the datalist list of records it brings me to another interface for editing.(where these textboxes etc will be displayed)
Problem:
Using
Quote:
DataList1.EditItemIndex = e.Item.ItemIndex
Quote:
CType(e.Item.FindControl("name_of_label"), Label).Text = objFAC_DES("FAC_DESC").ToString
dont bother about objFAC_DES("FAC_DESC").ToString
its a datareader... I ve checked all my sql query working perfectly in the code, somehow i can safely say that i've narrow down the problem to the datalist find control reference error.
It cannot work:error says object reference is not set to instance
This same code and method works for all the form elements in the main item template but not in the edit template.
I've also tried the following:
using page trace i manage to identify the ID of the form elements
Quote:
Dim myId As String = (CType(sender, DropDownList)).Parent.ClientID.ToString()
where sender is the object passed into the edit function
the id is something like "_clt0, _clt1"
Quote:
e.item.FindControl(myId).FindControl("lstDropDownList").text="Testing"
I've checked my asp theres no nested form tags only one form
I think it take more than a guru to solve this.
Pls advice thanks.