close
當要建立「字串」與「物件」時,
EX:字串 + 物件 + 字串
字串
string x = "";
x +="<>";
.
.
.
PlaceHolder1.Controls.Add(new LiteralControl(X));
物件
Button xbut = new Button();
xbut.ID = "";
xbut.Text = "";
xbut.Command += new CommandEventHandler(xbut_Command)
//+=按tab鍵2次即會自建,並在下面自建一個CommandEventArgs
PlaceHolder1.Controls.Add(xbut);
字串
string x1 = "";
x1 += "<>";
.
.
.
PlaceHolder1.Controls.Add(new LiteralControl(X1));
重點:變數不能重複使用。
全站熱搜