views:

178

answers:

1

I am having difficulties how to construct my question, but if I have to put it simply the situation is that I have categories of products. I have an aspx with a repeater on the left that lists the categories. And I want the products to be listed on the right. Category number is variable so I made an ascx with a DataList in it. When I try to do foreach category, ascx = new ascx(); then the DataList within this ascx control is null.

ps: what I want to do is to preload all the products (thre is not much) and hide the divs and fadein fadeout them using jQuery when a category div is clicked.

rightnow it is using jQuery.load(); and I don't like how the images load, cuz they download from top to bottom. Progressive gifs alsdo not an option. site demo is here http://techlipse.net/test/ledart

Thanks a lot in advance...

A: 

You need to use LoadControl(pathtoaspx) instead.

var ctrl = LoadControl("details.ascx") as MyControlClass;
// you can access public properties after this
ctrl.Data = user; 
placeholder.Add(ctrl);
Sergey Osypchuk
hmm... path to ascx you mean. Any insight why that happens?
Snoop Dogg
LoadControl will makehe difference instead of Controls.Add(new ascx()); .. right??
Snoop Dogg
Controls.Add(LoadControl("~/MyControl.ascx")) , with load control you go through the whole control life cycle. With new, you just create an empty object.
remi bourgarel
I added more detailed sample. However, I do not undertastand completely relation with jquerry - hope you will be able to find out solution
Sergey Osypchuk
I will hide these controls .. the Divs generated by these controls ... and use jquery to show them .. But thanx a lot for the answer ... I really appreciate it
Snoop Dogg