请问怎么取得txt控件里的值,tr.Visible = false;的地方取一个空""就行,然后把控件值组合成一个
{XX,XX,XX,,XX,XX,XX,,XX,XX}谢谢各位了! //画面初期添充动态文本控件
private void loadData1( string qName,string code)
{
string tempSQL = "";
tempSQL = tempSQL + " select table_name"; //0
tempSQL = tempSQL + " ,field_name"; //1
tempSQL = tempSQL + " ,use_flag"; //2
tempSQL = tempSQL + " ,show_name "; //3 if (Convert.ToString(Session["画面"]) == "" && qName == "")
{
tempSQL = tempSQL + "from add_field where table_name = 'cosmetics'";
tempSQL = tempSQL + "order by field_name asc";
}
else if (Convert.ToString(Session["画面"]) != "" && qName != "")
{
tempSQL = tempSQL + " from add_field ";
tempSQL = tempSQL + " where table_name = 'cosmetics'";
tempSQL = tempSQL + " and field_name = '" + qName + "'";
tempSQL = tempSQL + "order by field_name asc";
}
ds = dcom.DataBaseSelect(tempSQL);
DataTable dt = ds.Tables[0];
int lCount = dt.Rows.Count;
int intP; for (intP = 0; intP < lCount; intP++)
{
string str1 = dt.Rows[intP][3].ToString();
string str2 = dt.Rows[intP][2].ToString(); addTable(str1, code, str2, intP); if (intP == lCount)
{
Session["fullArray"] = Session["fullArray"] + str1;
}
else if (str2 == "1")
{
Session["fullArray"] = Session["fullArray"] + ",";
}
else
{
Session["fullArray"] = Session["fullArray"] + str1 + ",";
}
}
} private void addTable(string code, string qName, string del,int lng)
{
Table t = new Table();
TableRow tr = new TableRow();
TableCell tc_txt = new TableCell();
TableCell tc_controls = new TableCell();
System.Web.UI.WebControls.TextBox txt = new System.Web.UI.WebControls.TextBox(); if (del == "1")
{
tr.Visible = false;
}
else
{
tr.Visible = true;
tc_txt.Font.Size = 10;
tc_txt.Width = 100;
tc_txt.HorizontalAlign = HorizontalAlign.Center;
tc_txt.BorderWidth = 1;
tc_txt.ForeColor = System.Drawing.Color.White;
tc_txt.BackColor = System.Drawing.Color.FromName("#999999"); txt.ID = lng.ToString();
Response.Write(txt.Text); txt.Width = 350;
txt.Text = qName;
tc_txt.Text = code; tc_controls.Controls.Add(txt); tr.Cells.Add(tc_txt);
tr.Cells.Add(tc_controls);
t.Rows.Add(tr);
Table5.Rows.Add(tr); tc_txt.Dispose();
tr.Dispose();
txt.Dispose();
tc_controls.Dispose();
form1.Controls.Add(t);
}
}
{XX,XX,XX,,XX,XX,XX,,XX,XX}谢谢各位了! //画面初期添充动态文本控件
private void loadData1( string qName,string code)
{
string tempSQL = "";
tempSQL = tempSQL + " select table_name"; //0
tempSQL = tempSQL + " ,field_name"; //1
tempSQL = tempSQL + " ,use_flag"; //2
tempSQL = tempSQL + " ,show_name "; //3 if (Convert.ToString(Session["画面"]) == "" && qName == "")
{
tempSQL = tempSQL + "from add_field where table_name = 'cosmetics'";
tempSQL = tempSQL + "order by field_name asc";
}
else if (Convert.ToString(Session["画面"]) != "" && qName != "")
{
tempSQL = tempSQL + " from add_field ";
tempSQL = tempSQL + " where table_name = 'cosmetics'";
tempSQL = tempSQL + " and field_name = '" + qName + "'";
tempSQL = tempSQL + "order by field_name asc";
}
ds = dcom.DataBaseSelect(tempSQL);
DataTable dt = ds.Tables[0];
int lCount = dt.Rows.Count;
int intP; for (intP = 0; intP < lCount; intP++)
{
string str1 = dt.Rows[intP][3].ToString();
string str2 = dt.Rows[intP][2].ToString(); addTable(str1, code, str2, intP); if (intP == lCount)
{
Session["fullArray"] = Session["fullArray"] + str1;
}
else if (str2 == "1")
{
Session["fullArray"] = Session["fullArray"] + ",";
}
else
{
Session["fullArray"] = Session["fullArray"] + str1 + ",";
}
}
} private void addTable(string code, string qName, string del,int lng)
{
Table t = new Table();
TableRow tr = new TableRow();
TableCell tc_txt = new TableCell();
TableCell tc_controls = new TableCell();
System.Web.UI.WebControls.TextBox txt = new System.Web.UI.WebControls.TextBox(); if (del == "1")
{
tr.Visible = false;
}
else
{
tr.Visible = true;
tc_txt.Font.Size = 10;
tc_txt.Width = 100;
tc_txt.HorizontalAlign = HorizontalAlign.Center;
tc_txt.BorderWidth = 1;
tc_txt.ForeColor = System.Drawing.Color.White;
tc_txt.BackColor = System.Drawing.Color.FromName("#999999"); txt.ID = lng.ToString();
Response.Write(txt.Text); txt.Width = 350;
txt.Text = qName;
tc_txt.Text = code; tc_controls.Controls.Add(txt); tr.Cells.Add(tc_txt);
tr.Cells.Add(tc_controls);
t.Rows.Add(tr);
Table5.Rows.Add(tr); tc_txt.Dispose();
tr.Dispose();
txt.Dispose();
tc_controls.Dispose();
form1.Controls.Add(t);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货