前台:
<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(); }
时间: 2024-10-31 16:22:17