Home All Groups Group Topic Archive Search About

Datalist Dynamic Template Loading Problem

Author
19 May 2005 9:32 PM
matt.bailey
Hello-
I am failry new to asp.net but have been coding in general for a while.

I have a datalist whos templates are built on the fly.
In the Page_Init sub, based on a certain value, certain external
controls are assigned as the ItemTemplate and the EditTemplate.

1)If I only assign these templates if its not a post back, the datalist
is blank when I click on the edit button in the datalist.

2) If I let the page_init assign these templates everytime there is a
postback, the edit datalist renders correctly (a few drop downs and a
textbox).
But when I click my update button, I then try to a FindControl on my
datalist with a control I know is in the edit template but it gives me
this error:"Object reference not set to an instance of an object. "

Has anyone come across this?

Thanks in advanced!
MB

Author
20 May 2005 5:54 PM
mbailey
If any one else is interested, I found this article:
http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?FeedbackId=d9c93c38-71c7-4fbd-9667-264a1456ba8f

Basically:
" When the FormView's EditItemTemplate is dynamically loaded using
LoadTemplate, the attached data source control is passed zero
parameters when updating the record."

According to the doc, this problem is:

"Status:     Closed
Resolution:     Postponed"