2013-09-28 2 views
1

가 내 문제 야, 나는에 트링 지금까지 너무 좋아 나누었다을 동적으로 fileuploadfields를 추가하고이파일 업로드 필드는 여기

static List<FileUploadField> fuploadcollection = new List<FileUploadField>(); 

같은 컬렉션 뭔가에 각각의 파일 업로드 필드를 추가하고있는 빈 값을 얻을 fileuploadfield 내부에 이미지를 업로드, 나는 빈 fileupload field.but 그것이 "fuploadcollection"컬렉션을 중단 점으로 볼 때 가득한 것 같습니다.

여기 내 코드입니다.

addfileupload function; 여기

public partial class UserControl1 : System.Web.UI.UserControl 
    { 
     static int? _currentflag = 0; 

     static List<FileUploadField> fuploadcollection = new List<FileUploadField>(); 

........ 
........ 
......... 
     protected void addImages_Click(object sender, DirectEventArgs e) 
      { 
       int? nn = null; 

       X.Msg.Alert("hello", "hello").Show(); 
       _currentflag = (!string.IsNullOrEmpty(txtcurrentflag.Text)) ? Convert.ToInt32(txtcurrentflag.Text) : nn; 
       FileUploadField fileUploadField = new FileUploadField() 

       { 
        ID = "FileUploadField" + _currentflag, 
        Width = 280, 
        Icon = Icon.Add, 
        ClientIDMode = ClientIDMode.Static, 
        Text = "Göz at", 
        FieldLabel = "Resim-" + _currentflag, 
        Flex = 1, 
        ButtonText="resim seç" 

       }; 

       fileUploadField.AddTo(this.pnlResim, true); 
       if (string.IsNullOrEmpty(txtcurrentflag.Text) || txtcurrentflag.Text == "0") 
       { 
        fuploadcollection.Clear(); 
       } 
       fuploadcollection.Add(fileUploadField); 

       _currentflag++; 
       txtcurrentflag.Text = _currentflag.ToString(); 


      } 

는 *하지만이 fuploadcollection 작성 보인다 (그것의 수를 forexample 보여줍니다 더 한 후) 당신이

  foreach (var item in fuploadcollection) 
       { 
        if (item.HasFile) 
        { 
         string resimadi = UploadImage.UploadImages(item); 
+0

당신이 얻을 예외가 무엇인가? – Damith

+0

예외 없음 fileupload fields empty – sakir

+0

txtcurrentflag 텍스트 상자에 어떤 값을 지정 하시겠습니까? – Damith

답변

관련 문제