当前位置: 代码迷 >> ASP >> 类型的声明上缺少 partial 修饰符;存在此类型的其他分部声明解决办法
  详细解决方案

类型的声明上缺少 partial 修饰符;存在此类型的其他分部声明解决办法

热度:704   发布时间:2012-04-21 14:34:44.0
类型的声明上缺少 partial 修饰符;存在此类型的其他分部声明

UploadImage.aspx的代码如下:


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UploadImage.aspx.cs" Inherits="UploadImage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  protected void Page_Load(object sender, EventArgs e)
  {

  }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title>无标题页</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
   
  上传图片(选择你要上传的图片)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  <asp:FileUpload ID="FileUpload1" runat="server" />
  </div>
 <P> 文件说明(添加图片说明.如:作者,说明,出处)&nbsp;&nbsp; 
  <asp:TextBox ID="TextBox1" runat="server" Height="24px"></asp:TextBox>
  </p>
  <p>
&nbsp;&nbsp;&nbsp;<asp:Label ID="Label1" runat="server" Text="txtMessage"></asp:Label>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" 
  Width="190px" />
  </p>
  </form>
 </body>
</html>







UploadImage.aspx.cs的代码如下:
  using System;  
  using System.Web;  
  using System.IO;  
  using System.Data;  
  using System.Data.SqlClient;  
  using System.Web.UI;  
  using System.Web.UI.WebControls;  
  using System.Web.UI.HtmlControls;



  public class UploadImage : Page
  {
  protected HtmlInputFile UP_FILE; //HtmlControl、WebControls控件对象  
  protected TextBox txtDescription;
  protected Label txtMessage;
  protected Int32 FileLength = 0; //记录文件长度变量  
  protected void Button_Submit(System.Object sender, System.EventArgs e)
  {
  HttpPostedFile UpFile = UP_FILE.PostedFile; //HttpPostedFile对象,用于读取图象文件属性  
  FileLength = UpFile.ContentLength; //记录文件长度  
  try
  {
  if (FileLength == 0)
  相关解决方案