Datalist Dynamic Template Loading Problem

M

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,128
Latest member
ElwoodPhil
Top