title: FileUpload.HasFile property is always false,While File Upload is place inside GridView
body: <p>I have Tab Container, and i have a GridView inside that. I need to upload image while i am clicking on the particular row. I am using update Panel too, outside of the grid view, i was able to upload image using PostBack Trigger to "preview Button", but inside gridview i don know how to access it. I just created one button called btngrvPreview outside of the gridview and called its click event to the button btnPreview1 which is placed inside gridView. I think this approach is correct only.. But i don know why this Trigger to btnPreview1 is not working.</p>
  
  <p>Its showing if(vFile.HasFile ) condition is always getting false..</p>
  
  <p>Help me to solve this problem.</p>
  
  <p><strong>GridView</strong></p>
  
  <pre><code> &lt;asp:GridView ID="grvItem" runat="server" AutoGenerateColumns="False" OnRowDataBound="grvItem_RowDataBound"                                                ShowFooter="True" SkinID="grid" Width="100%"&gt;  
      &lt;Columns&gt;                 
      &lt;asp:BoundField HeaderText="Reference&amp;nbsp;ID" /&gt;
      &lt;asp:TemplateField HeaderText="Design"&gt;
  &lt;ItemTemplate&gt;
  &lt;asp:Label ID="grvlbldesign" runat="server" CssClass="lbl"&gt;
      &lt;/asp:Label&gt;
      &lt;/ItemTemplate&gt;                 
      &lt;/asp:TemplateField&gt;     
  &lt;asp:TemplateField HeaderText="Upload Image"&gt;
      &lt;ItemTemplate&gt;
  &lt;asp:HiddenField ID="hifgrvImage" runat="server" /&gt;
      &lt;a ID="grvuploadimgPopup" runat="server"&gt;
      &lt;asp:Image ID="grvUploadImage" runat="server" Width="90px" /&gt;
      &lt;/a&gt;                                                                                 &lt;/ItemTemplate&gt;             
      &lt;EditItemTemplate&gt;                                                                   
      &lt;asp:FileUpload ID="fupImage1" runat="server" CssClass="fileuploadbtn" TabIndex="5" ToolTip="Browse For Image" Width="152px"/&gt;         
      &lt;asp:ImageButton ID="btnPreview1" runat="server" ImageUrl="~/images/view.gif" TabIndex="5" ToolTip="Preview" onclick="btngrvPreview_Click"/&gt;
    &lt;/EditItemTemplate&gt;                                                                        
  &lt;/asp:TemplateField&gt;     
      &lt;Triggers&gt;
      &lt;asp:PostBackTrigger ControlID="btngrvPreview" /&gt;                   
      &lt;/Triggers&gt;
  </code></pre>
  
  <p><strong>Button Click EVent</strong></p>
  
  <pre><code>protected void btnPreview1_Click(object sender, ImageClickEventArgs e)
   {
    try
       {
              int rowIndex = Convert.ToInt32(hifRecordID.Value);
              Image vimgView = (Image)grvItem.Rows[rowIndex].FindControl("grvUploadImage");
              System.Web.UI.WebControls.FileUpload vFile = (System.Web.UI.WebControls.FileUpload)grvItem.Rows[rowIndex].FindControl("fupImage1");
  
              string strimage;
              string strfilename, strextn;
              if (vFile.HasFile)
              {
                  System.IO.Path.GetExtension(vFile.FileName);
                  string strfileExtension = System.IO.Path.GetExtension(vFile.FileName).ToLower();
                  string[] strAllowedFileExtensions = { ".gif", ".jpeg" };
                  if (strfileExtension == ".jpeg")
                      strfileExtension = ".gif";
                  if (FileExtensionIsApproved(strfileExtension) == true)
                  {
                      strfilename = System.IO.Path.GetFileName(vFile.PostedFile.FileName);
                      strextn = System.IO.Path.GetExtension(strfilename);
                      strimage = ObjDataAccess.LoginName + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfffffff") + strextn;
                      ViewState["Filename"] = strimage;
                      string strpath = ConfigurationManager.AppSettings["ITEMPHOTO"] + strimage;
                      //Server.MapPath("empphoto") + "\\" + strimage;
  
                      vFile.PostedFile.SaveAs(strpath);
                      if (hifimgbrowser.Value == "IE")
                      {
                          vimgView.ImageUrl = strpath;
                          // tstimg.HRef = vimgView.ImageUrl;
                      }
                      else
                      {
                          vimgView.ImageUrl = "~/Handler.ashx?id=" + strpath;
                          // tstimg.HRef = imgView.ImageUrl;
                      }
                      vimgView.Visible = true;
                      System.IO.Stream fs = vFile.PostedFile.InputStream;
                      byte[] bytMyData = new byte[fs.Length + 1];
                      fs.Read(bytMyData, 0, Convert.ToInt32(fs.Length));
                      fs.Close();
                  }
                  else
                  {
                      // DeleteImageFile();
                      vimgView.ImageUrl = "";
                      //  tstimg.HRef = "";
                      vimgView.Visible = true;
                  }
              }
          }
          catch (Exception ex)
          {
              strMsg = ex.Message;
              ScriptManager.RegisterStartupScript(Page, this.GetType(), "alertScript", "showMsgbox('" + strMsg + "','','2','');", true);
          }
      }
  </code></pre>
  
  <p>Thanks in advance.</p>