开发者

Webusercontrol objects not working

I am using some web user controls on a website I am creating, but the problem is that sometimes visual studio cant load the control because he (my guess) needs a namespace imported where the web user control is located in. To make things more clear here's the line of code I am reusing to make objects of the web user control.

Criterialijn criterialijn = (Criterialijn)LoadControl("~/Criterialijn.ascx");

When I first execute this, he does not kno开发者_高级运维w about what object I am talking about, but when I drag and drop the .ascx control into the app_code folder and drag and drop it back out, everything is fine : he lets me load the web user controls and knows about what object I am talking about. Now this is a kind of retarded solution so my question is how do I fix the web user control so that he immediately knows about what object I am talking about when I create it?


This is how I do using a placeholder. Hope it helps.

Criterialijn criterialijn = (Criterialijn)LoadControl("~/Criterialijn.ascx");
PlaceHolder1.Controls.Add(criterialijn);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜