首页 > 其他 > 详细

前台自动生成控件

时间:2017-07-23 15:14:06      阅读:240      评论:0      收藏:0      [点我收藏+]

前台:

<div id="location" runat="server">
</div>

后台:
    /// <summary> /// 自动生成button控件 /// </summary> public void GenerateControls() { StringBuilder strbHTMl = new StringBuilder(); strbHTMl.Append("<table>"); int count = 0; for (int i=0;i<100;i++) {//设置一行显示的库位个数 if (count == 0) { strbHTMl.Append("<tr>"); } if (count == 9) { strbHTMl.Append("</tr>"); count = 0; } strbHTMl.Append("<td>");    strbHTMl.Append("<input id=\"button" + garageNumber + "\" type=\"button\" style=\"background:" + color + ";color:white;\" value=\"" + garageNumber + "\" class=\"Button\" onclick=\" window.showModalDialog(‘../LocationStatus.aspx/?Enter=" + garageNumber + "‘, ‘‘, ‘dialogHeight=30;dialogWidth=60;dialogTop=30;dialogLeft=465;center=yes;resizable:no;scroll:no;status:no;help=no‘)\" \">"); //strbHTMl.Append("<input id=\"button" + garageNumber + "\" type=\"button\" style=\"background:" + color + ";color:white;\" value=\"" + garageNumber + "\" class=\"Button\" onclick=\"window.open(‘../LocationStatus.aspx/?Enter=" + garageNumber + "‘, ‘newwindow‘, ‘height=450, width=900, top=300, left=490, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no‘)\" \">"); strbHTMl.Append("</td>"); count++; } strbHTMl.Append("</table>"); location.InnerHtml = strbHTMl.ToString(); }

 

前台自动生成控件

原文:http://www.cnblogs.com/ingvner/p/7224549.html

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