當前位置:編程學習大全網 - 網絡軟體 - 急求解決:ASP.NET DotNetTextBox配置後不能編輯,編輯框是不能用的,怎麽回事啊?

急求解決:ASP.NET DotNetTextBox配置後不能編輯,編輯框是不能用的,怎麽回事啊?

上傳文件的話,用FileUpload控件,工具箱裏有這個控件,後臺代碼如下:

protected void Upload_Click(object sender, EventArgs e)

{

String path = Server.MapPath("../Document/");

String Introduction = "";

if (up.HasFile)

{

if (up.FileContent.Length <= 4000 * 1024)

{

SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=jiaoxue;Integrated Security=True");

conn.Open();

SqlCommand cmd = new SqlCommand("select count(*) from Document where doc_name='" + up.FileName.ToString().Trim() + "'", conn);

int i = Convert.ToInt32(cmd.ExecuteScalar());

conn.Close();

if (i > 0)

{

MessageBox.Show("您上傳的文件或文件名以存在,請重新確認後再上傳!");

return;

}

if (introduction.Text.ToString().Trim() == "")

{

Introduction = "暫無對該文件的說明!";

}

else

{

Introduction = introduction.Text.ToString().Trim();

}

introduction.Text = "";

up.PostedFile.SaveAs(path + up.FileName);

long size = up.FileContent.Length / 1024;

string filesize = size.ToString() + " k";

conn.Open();

cmd = new SqlCommand("insert into Document(user_name,doc_name,doc_size,doc_address,upload_time,introduction) values('" + Session["Username"].ToString().Trim() + "','" + up.FileName.ToString().Trim() + "','" + filesize.Trim() + "','" + path.ToString().Trim() + "','" + System.DateTime.Now.ToString() + "','" + Introduction + "')", conn);

cmd.ExecuteNonQuery();

conn.Close();

Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('上傳成功!')</script>");

return;

}

else

{

MessageBox.Show("對不起,由於您的文件過大無法上傳!");

return;

}

}

else

{

Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('您還沒有選擇要上傳文件!')</script>");

return;

}

}

//這個允許上傳最大4M的文件,妳可以試壹下

  • 上一篇:愛馬仕有哪些好看的男裝T恤?
  • 下一篇:學好英語的基本方法
  • copyright 2024編程學習大全網