FileUpload and GridView in Update panel

Vadim2004
Vadim2004 used Ask the Experts™
on
Hi experts I have following scenario:
 GridView inside Update panel
 FileUpload control two texts and submit button out of Update panel.
There two ways to gather data -
 by using submit button - it works fine - file along with data from two texts gets saved in db.
Second- by clicking on GridView row - data from row and FileUpload
Should be saved to db, however, in second scenario FileUpload.HasFile returns false.
In both cases page should be closed and one of parameters should be returned to parent page.
Please advise.

thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014
Commented:
The reason is that the FileUpload is outside update panel so when gridview row is clicked, the FileUpload has not uploaded the file (it will do that only with full postback) hence the HasFile = False.

Solution: Move the fileupload to inside the update panel.

Author

Commented:
Should it be in the same Update panel or its own, with gridview  trigger?
And can update panels be nested -these controls are located on different parts of the page?
Most Valuable Expert 2012
Top Expert 2014

Commented:
I think it needs to be in same update panel. Give that a try first.

Author

Commented:
Thanks CodeCruiser, it helps  - working fine

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial