//方法1
<asp:label id="MessageBox" runat="Server" CssClass="test"/>

MessageBox.Text = "";
for (int i = 1; i <= 10; i++)
{
    MessageBox.Text = MessageBox.Text + i.ToString() + "<input type='Text' id='Box_" + i + "' name='Box_" + i + "' value='" + this.Request["Box_" + i] + "' /><br />\r\n";
}

 

//方法2
TextBox objTextbox = new TextBox();
objTextbox.ID = "Label" + i.ToString();
objTextbox.Text = "Label" + i.ToString();
objTextbox.Attributes["style"] = "Z-INDEX: 101; LEFT: 228px; POSITION: absolute; TOP: " + (100 + i * 30).ToString() + "px";
Page.FindControl("form1").Controls.Add(objTextbox);

 

//方法3
TextBox textBox = new TextBox();
Form.Controls.Add(textBox);

Label label = new Label();
label.Text = i.ToString();
Form.Controls.Add(label);

Literal literal = new Literal();
literal.Text = i.ToString();
Form.Controls.Add(literal);


arrow
arrow
    全站熱搜

    Roger 發表在 痞客邦 留言(0) 人氣()