File Download Control Issue in Edit Popup

5 posts, 0 answers
  1. John John
    John John avatar
    132 posts
    Member since:
    Aug 2009

    Posted 13 May 2011 Link to this post

    Hi
    I am using file download control in my Edit Popup as given below;
    <input type="file" id="file1" runat="server" name="file1" />

    But when i try to  get the value from the control i am getting null value though i selected the desired file i want to download.
    string fileName = (e.Item.FindControl("file1") as HtmlInputFile).PostedFile.FileName;

    I am also not able to empty validation with traditional asp.net required field validator. But in normal form it works fine as desired.
    So please let me know how to get and validate the value from filedownload control as soon as possible

    -thanks
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 May 2011 Link to this post

    Hello John,

    I am not quite sure about the event that you are trying to access the control. If you want to access the control in edit mode access the control like this.
    C#:
    protected void RadGrid1_ItemDataBound1(object sender, GridItemEventArgs e)
      {
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem edititem = (GridEditFormItem)e.Item;
            string fileName = (e.Item.FindControl("file1") ;
      }

    Thanks,
    Shinu.
  3. John John
    John John avatar
    132 posts
    Member since:
    Aug 2009

    Posted 16 May 2011 Link to this post

    Hi Shinu,

    I already used the same way (ItemDataBound Event)  to get the value from that control. Though I could easily find the control through FindControl method, but i am not able to get the value from the variable, it shows null value..

    Please kindly look into this strange issue

    -Thanks
  4. John John
    John John avatar
    132 posts
    Member since:
    Aug 2009

    Posted 16 May 2011 Link to this post

    Hi,

    I am looking for suggestions from you. I would be more happy if i am domonstrated with an small running exmaple.
    I am using EditPopup customized the formtemplate with the input fields like textboxes,labels,buttons)
    I am also looking for functioning required fileld validator for the same control

    -Thanx
  5. John John
    John John avatar
    132 posts
    Member since:
    Aug 2009

    Posted 17 May 2011 Link to this post

    Hi,
    I am awaiting for suggestions at the earliest

    -Thanks

Back to Top