如何在更新面板内部分回发期间存储值
我的更新面板中有一个ajax文件上传功能,可以在用户选择要上传的文件后立即上传文件。在 btnVidUpload_Click
中上传文件期间,我将文件名分配给也在更新面板内的隐藏字段。然后,当我单击“提交”时,Send_Click 尝试从隐藏字段中获取值,但隐藏字段为空,为什么隐藏字段会丢失其值,它不能在回发期间保留该值吗?或者有没有一种方法可以存储该值而无需使用会话。谢谢
<asp:AsyncFileUpload ID="AFU_Video" OnUploadedComplete="btnVidUpload_Click"
runat="server" UploaderStyle="Traditional" ThrobberID="aajaxLoader" />
<asp:HiddenField ID="Hidd_VideoLoc" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:ImageButton ID="btn_Send" Text="Submit" runat="server" OnClick="Send_Click" />
I have a ajax file upload inside my update panel to upload the file immediately after the user selects a file to upload. During the file upload in btnVidUpload_Click
I assign the file name to the hidden field which is also inside the update panel. Then when I click Submit Send_Click tries to get the value from the hidden field, but the hidden field is empty, why is the hidden field losing its value, cant it retain the value during post back or is there a way to store the value without using session. thanks
<asp:AsyncFileUpload ID="AFU_Video" OnUploadedComplete="btnVidUpload_Click"
runat="server" UploaderStyle="Traditional" ThrobberID="aajaxLoader" />
<asp:HiddenField ID="Hidd_VideoLoc" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:ImageButton ID="btn_Send" Text="Submit" runat="server" OnClick="Send_Click" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AsyncFileUpload
在内部使用 iFrame 来呈现FileUpload
控件。这就是它似乎失去价值的原因。
您需要使用
btnVidUpload_Click
中的Session。自己对类似问题的回答:https://stackoverflow.com/a/8495986/284240
The
AsyncFileUpload
internally uses an iFrame to render theFileUpload
control.That is the reason why it seems to lose it's value.
You need to use the Session in
btnVidUpload_Click
.Own answer on a similar question: https://stackoverflow.com/a/8495986/284240