Datalist and LoadTemplate

A

Albert

I have a main web page that allows a user to perform searches on our
products. On this main web page I have a datalist that I would like to use
for all types of searches and it's declares as follows:

<asp:datalist id="ddl_generic" onitemCommand="itemSelected" runat=server>

</asp:datalist>

For the Header Template, Item Template and footer templates I have separate
ascx files that contain the content for the datalist based on the Search Type
selected by the user. The Search Type is a Text Box and 2 dropdowns lists.

The issue is that while I can load the templates with no problems I cannot
get the OnItemCommad event to fire unless the templates are loaded within the
Page's Init Sub. This would be fine except that the values from the Search
Type control are not refreshed until the Page Load event occurs.

So how does one wire up the loaded template's controls to the Datalist's
OnItemCommand event outside of the Page's Init Sub?

Thanks for the help!
 
G

Galin Iliev

if I understood your question correctly you want to init your user controls
use Page.Prerender event as thus you can be sure ther are already loaded

regards
Galin Iliev
 
A

Albert

Do you mean load up the Templates for the Datalist in the PreRender event?

Thanks for your time,
Albert
 
A

Albert

I loaded up the Templates in the Page.Prerender event but now the
Datalist does not display any Header,Item or Footer info. No Errors
encountered.

Just need to wire up the Template's controls to the Datalist's
onItemCommand...seems simple enough....

Thanks again..
 

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
474,263
Messages
2,571,064
Members
48,769
Latest member
Clifft

Latest Threads

Top