nikron2626
asked on
Editing an item in a nested datalist
Hi,
I have a datalist control with another datalist embedded in the item template. I successfully bind and show all the appropriate records and the 'child' records. The problem occurs when I click an edit button or the cancel button when in the edit item template. When the user clicks the edit button in the child datalist it must change the edititemindex and rebind. If I use the databind command it falls over giving me a 'Object variable with block not set' error. The strange thing is if I take out the databind method and simply set the index it will work the SECOND time I click the edit button. Then when it is in the edit mode and I click the cancel button the exact same thing happens. I take out the databind method and have to click the cancel button twice to get it to reset the child data list.
I have a datalist control with another datalist embedded in the item template. I successfully bind and show all the appropriate records and the 'child' records. The problem occurs when I click an edit button or the cancel button when in the edit item template. When the user clicks the edit button in the child datalist it must change the edititemindex and rebind. If I use the databind command it falls over giving me a 'Object variable with block not set' error. The strange thing is if I take out the databind method and simply set the index it will work the SECOND time I click the edit button. Then when it is in the edit mode and I click the cancel button the exact same thing happens. I take out the databind method and have to click the cancel button twice to get it to reset the child data list.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the child datalist or any child control inside the datalist has to be referred to using the findcontrol method.
ASKER