I have tried below both coding part. My requirement is to add images to griedview lines. So when I am clicking on an item in grid, it will popup a div containing fileuplod control.
I need to update this without refreshing page. so when I am using <asp:AsyncPostBackTrigger ControlID="Btn_UploadImage" EventName="Click" /> I am not getting "hasfile" or file name.
but if I use second option -- <asp:PostBackTrigger ControlID="Btn_UploadImage" /> working properly, BUT PAGE REFRESHING / POSTBACK IS WORKING. I need to do this without refreshing the page.
I have verified this. My fileupload control is in a DIV (which is display:none mode) inside UPDATE PANEL, this DIV only display at the time of clicking gridlink button.
so normal asp.net fileupload is supporting, and this is working with a BUTTON click if I added <asp:PostBackTrigger ControlID="Btn_UploadImage" /> in TRIGGER section.
but in this case, full page is refreshing. I need to do this without refreshing whole page. So I placed <asp:AsyncPostBackTrigger ControlID="Btn_UploadImage" EventName="Click" /> in this case BUTTON click is working without
refreshing whole page, But fileupload control showing value null.
According to your description, as far as I know, if you want to use fileupload inside updatepanel, I think it needs a full postback. You could add a breakpoint in the click event, check if get the file. For more details, please check the following document:
Using FileUpload Control inside ASP.Net AJAX UpdatePanel Control:
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
I have read the details in the link, and which I have already read and tried. while trying Button with AsyncPostBackTrigger Hasfile returns null., but if we are using PostBackTrigger
file uploading is working properly. But issue is why I placed this popup div inside update panel means, I need to avoid page refreshing / postback function.
Scenario is, I have a grid with number of line items. Number of lines may be 1 - 100 or 200 or more, Users need to add Images against each line item in this grid. So I have placed an image control in one column, and ItemNumber filed set it as a link
button. So when I click on 10 line, will popup DIV, shows the Line item number and description on there, and placed this Fileupload control and Upload button in this DIV. so popup DIV is properly working without postback as I used Jquery to popup the DIV,.
and I can select the file also without page refresh. I need to update the Grid with the uploaded image at the time of UploadButton Click. So if I am giving PostBackTrigger here, page will refresh and move to top area. In this case,
if users entering 20th, or 30th lines page will refresh and they need to drag to down again to add image for next line item. This will be a tedious practice if we have more items in Grid.
Hope you have understand my scenario. Now after continues research for this, I could upload files without postback using Jquery and Generic Handler page. But still I couldn't bind the grid after file upload as we cannot call codebehind method from Jquery.
we can call static method, but in this case page controls are not accessible.
None
0 Points
6 Posts
Using FileUpload Control inside ASP.Net AJAX UpdatePanel Control
Jun 07, 2017 08:14 AM|sajeesh|LINK
I have tried below both coding part. My requirement is to add images to griedview lines. So when I am clicking on an item in grid, it will popup a div containing fileuplod control.
I need to update this without refreshing page. so when I am using <asp:AsyncPostBackTrigger ControlID="Btn_UploadImage" EventName="Click" /> I am not getting "hasfile" or file name.
but if I use second option -- <asp:PostBackTrigger ControlID="Btn_UploadImage" /> working properly, BUT PAGE REFRESHING / POSTBACK IS WORKING. I need to do this without refreshing the page.
<Triggers> <asp:AsyncPostBackTrigger ControlID="Btn_UploadImage" EventName="Click" /> </Triggers>
-----------------------------
<Triggers> <asp:PostBackTrigger ControlID="Btn_UploadImage" /> </Triggers>
regards,
Sajeesh
All-Star
52673 Points
15719 Posts
Re: Using FileUpload Control inside ASP.Net AJAX UpdatePanel Control
Jun 07, 2017 08:26 AM|oned_gk|LINK
AFAIK FU need full postback,
Try using below control
http://www.ajaxcontroltoolkit.net/AsyncFileUpload/AsyncFileUpload.aspx
Suwandi - Non Graduate Programmer
None
0 Points
6 Posts
Re: Using FileUpload Control inside ASP.Net AJAX UpdatePanel Control
Jun 07, 2017 10:20 AM|sajeesh|LINK
thanks for your reply.
I have verified this. My fileupload control is in a DIV (which is display:none mode) inside UPDATE PANEL, this DIV only display at the time of clicking gridlink button.
so normal asp.net fileupload is supporting, and this is working with a BUTTON click if I added <asp:PostBackTrigger ControlID="Btn_UploadImage" /> in TRIGGER section.
but in this case, full page is refreshing. I need to do this without refreshing whole page. So I placed <asp:AsyncPostBackTrigger ControlID="Btn_UploadImage" EventName="Click" /> in this case BUTTON click is working without
refreshing whole page, But fileupload control showing value null.
regards,
sajeesh
Contributor
6730 Points
2715 Posts
Re: Using FileUpload Control inside ASP.Net AJAX UpdatePanel Control
Jun 14, 2017 02:00 AM|Eric Du|LINK
Hi sajeesh,
According to your description, as far as I know, if you want to use fileupload inside updatepanel, I think it needs a full postback. You could add a breakpoint in the click event, check if get the file. For more details, please check the following document:
Using FileUpload Control inside ASP.Net AJAX UpdatePanel Control:
https://www.aspsnippets.com/Articles/Using-FileUpload-Control-inside-ASP.Net-AJAX-UpdatePanel-Control.aspx
Best Regards,
Eric Du
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
All-Star
52673 Points
15719 Posts
Re: Using FileUpload Control inside ASP.Net AJAX UpdatePanel Control
Jun 14, 2017 02:12 AM|oned_gk|LINK
It's everyone issue for upload control inside ajax panel i guess.
- option1 use full postback
- option2 dont use fileupload control, you can use fileupload control from ajaxcontroltoolkit
Suwandi - Non Graduate Programmer
None
0 Points
6 Posts
Re: Using FileUpload Control inside ASP.Net AJAX UpdatePanel Control
Jun 14, 2017 01:22 PM|sajeesh|LINK
Eric Du,
First of all thanks for your reply.
I have read the details in the link, and which I have already read and tried. while trying Button with AsyncPostBackTrigger Hasfile returns null., but if we are using PostBackTrigger file uploading is working properly. But issue is why I placed this popup div inside update panel means, I need to avoid page refreshing / postback function.
Scenario is, I have a grid with number of line items. Number of lines may be 1 - 100 or 200 or more, Users need to add Images against each line item in this grid. So I have placed an image control in one column, and ItemNumber filed set it as a link button. So when I click on 10 line, will popup DIV, shows the Line item number and description on there, and placed this Fileupload control and Upload button in this DIV. so popup DIV is properly working without postback as I used Jquery to popup the DIV,. and I can select the file also without page refresh. I need to update the Grid with the uploaded image at the time of UploadButton Click. So if I am giving PostBackTrigger here, page will refresh and move to top area. In this case, if users entering 20th, or 30th lines page will refresh and they need to drag to down again to add image for next line item. This will be a tedious practice if we have more items in Grid.
Hope you have understand my scenario. Now after continues research for this, I could upload files without postback using Jquery and Generic Handler page. But still I couldn't bind the grid after file upload as we cannot call codebehind method from Jquery. we can call static method, but in this case page controls are not accessible.
Regards,
Sajeesh