首页 > Web开发 > 详细

在mvc里面有htmlhelper方法,在webform里面有什么?

时间:2015-09-04 16:51:51      阅读:304      评论:0      收藏:0      [点我收藏+]

终于是找到原来在webform里面已经提供了htmlcontrol这样的控件,可以直接拿来用。以前一直在想mvc有htmlhelper,webform里面不能用,其实是webform里面已经有了。

例子

HtmlGenericControl htmlgeneric = new HtmlGenericControl("div");
htmlgeneric.Attributes.Add("data-dojo-type", "dijit/Toolbar");
htmlgeneric.ClientIDMode = ClientIDMode.Static;//.net 4下面才有此属性,2的话就没有了。
htmlgeneric.ID = "toolbar1";

HtmlGenericControl btna = new HtmlGenericControl("div");
btna.Attributes.Add("data-dojo-type", "dijit/form/Button");
btna.Attributes.Add("data-dojo-props", "iconClass:‘dijitIconDelete‘, showLabel:false,onClick:function(){ return Delete();}");
btna.ClientIDMode = ClientIDMode.Static;
btna.ID = "toolbar1.clear";

HtmlGenericControl griddiv = new HtmlGenericControl("div");
griddiv.ClientIDMode = ClientIDMode.Static;
griddiv.ID = "gridDiv";


htmlgeneric.Controls.Add(btna);

this.Controls.Add(htmlgeneric);
this.Controls.Add(griddiv);

 

在mvc里面有htmlhelper方法,在webform里面有什么?

原文:http://www.cnblogs.com/forhell/p/4781933.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!