页面上有20个TextBox和File1,根据他们的值进行判断再操作,如下面:
if (this.File1.Value != "" && this.TextBox1.Text != "")
{
flashPath = this.File1.PostedFile.FileName;
flashPath2 = flashPath.Substring(flashPath.LastIndexOf("\\"));
File.Copy(flashPath, Framework.GlobalModule.ImagePath + @"FlashPhoto" + "\\" + flashPath2, false);
bbf.SendBuildingPhoto(buildingName, buildingPhoto, type, bid, orders);
}
~~~~~~
这可是20个啊,大家有什么方法只做一个判断,然后执行相应的操作
if (this.File1.Value != "" && this.TextBox1.Text != "")
{
flashPath = this.File1.PostedFile.FileName;
flashPath2 = flashPath.Substring(flashPath.LastIndexOf("\\"));
File.Copy(flashPath, Framework.GlobalModule.ImagePath + @"FlashPhoto" + "\\" + flashPath2, false);
bbf.SendBuildingPhoto(buildingName, buildingPhoto, type, bid, orders);
}
~~~~~~
这可是20个啊,大家有什么方法只做一个判断,然后执行相应的操作
{
string controlname = "TextBox" + i.ToString();
TextBox control = (TextBox)this.Controls.FindControl(controlname); .... }
{
if (control is System.Windows.Forms.TextBox)
{
System.Windows.Forms.TextBox tb = (System.Windows.Forms.TextBox)control ;
tb.Text = String.Empty ;
}
}
TextBox control = (TextBox)this.FindControl(controlname);