我在驗證PlaceHolder中的所有文本框時遇到問題。 我做了PlaceHolder,我不知道如何檢查所有的文本框都有整數作爲文本。有任何想法嗎?驗證PlaceHolder中的所有文本框
public void Made_Matrix (PlaceHolder Matrix, int Size){
for(int row=0; row < size; row++){
for(int col=0; col < size; col++){
TextBox TB = New TextBox();
Matrix.Controls.Add(TB);
TB.ID = TB + Convert.ToString(row) + Convert.ToString(col);
TB.AutoPostBack = "true";
}
Matrix.Controls.Add(new LiteralControl ("<br/>"));
}
}
public void TB_Validate (PlaceHolder Matrix, int Size){
for (int row = 0; row < size; row++){
for (int col = 0; col < size; col++){
string Ident = TB + Convert.ToString(row) + Convert.ToString(col);
我該如何找到文本隱藏在ID爲Ident的TextBox中?以及如何檢查它是否是數字?我想在.NET中沒有像IsNumeric()這樣的函數,對嗎?
好吧,這是個好主意,但如何讓每個文本框的文本...:/ – Alliah 2010-11-11 16:54:43
我已經用兩種方法更新了回答文本框。 – batwad 2010-11-12 11:42:17