Ivan90
Ivan90

Reputation: 151

AsyncFileUpload and GridView

I've a little problem. I have in the same page an AsyncFileUpload and a gridview. How do I update this gridview immediatly after it has been done upload with AsyncFileUpload?

Thanks

Upvotes: 2

Views: 2848

Answers (1)

madi9k
madi9k

Reputation: 11

I have a solution that i am using, maybe there are better ones but at least it's working:

On your aspx page create a div like:

<div style="visibility: hidden;">
   <asp:Button ID="btnHidden" runat="server" OnClick="btnHidden_Click" Text="Button" />
</div>

On your AsyncFileUpload's OnUploadedComplete event write a code that stores the needed informations about the uploaded file in Session variables (since AsyncFileUpload dont have a viewstate).

On your AsyncFileUpload's OnClientUploadComplete place a Javascript function that click's the hidden button and in the codebehind the hidden button's click method is binding your gridview and clearing the session. Thats all! :)

ps.: wrap around your gridview with an updatepanel and your page wont blink

Upvotes: 1

Related Questions