开发者

Render an asp.net control from a text string

开发者 https://www.devze.com 2022-12-24 10:37 出处:网络
I\'m not sure if it is possible to render an asp.net control from a string. The string contains fragments of html code and I\'ve tried rendering that string to a div tag settingthe following attribute

I'm not sure if it is possible to render an asp.net control from a string. The string contains fragments of html code and I've tried rendering that string to a div tag setting the following attributes: runat="server", asp panel contain, asp label control and asp literal control.

These attributes do not render the control in t开发者_开发问答hat text to an actual control. The result remains as a string.

I've also tried adding <% %> around the attributes but this is not accepted.

Thanks in advance.


You may need to instantiate your control in the code behind (e.g. new Label()) and then add that control to a placeholder control that you put on your page.


Literal and Label do this job. Please specify some code for more understanding.

Also you may look to http://msdn.microsoft.com/en-us/library/f93yf0ee(VS.80).aspx

0

精彩评论

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

关注公众号