How to hide/show a control using AJAX (AjaxControlToolkit) and C# -
i know must sound basic i'm stumped here. i'm trying show hyperlink once process has completed. , process asyncfileupload. in aspx page, want create have hidden on initial page load. if set style="display: none;" seems work after file upload, nothing do, make control visible again. when file uploaded, calls function called fileuploadcomplete. it's in here no matter do, hyperlink won't display.
any appreciated :)
thank you, dave
here aspx code (with added javascript)
<asp:content id="content1" contentplaceholderid="head" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="optionsplaceholder" runat="server"> <script language="javascript" type="text/javascript"> function showlink() { $("#openfile").show(); } </script> </asp:content> <asp:content id="content3" contentplaceholderid="contentplaceholderbody" runat="server"> <asp:updatepanel id="updimportfile" runat="server" updatemode="conditional"> <contenttemplate> <div class="pageheader"> <asp:literal runat="server" id="pagetitle" text="<%$ resources:resources, importfile %>" /> </div> <ajaxtoolkit:asyncfileupload id="fileupload1" runat="server" width="600px" uploaderstyle="traditional" onuploadedcomplete="fileuploadcomplete" throbberid="throbber" completebackcolor="#e9f2fd" onclientuploadcomplete="showlink" /> <asp:image runat="server" id="throbber" imageurl="images/loading.gif" /> <br /> <asp:hyperlink runat="server" id="openfile" navigateurl="~/openfile.aspx" text="open" style="display:none;"/> </contenttemplate> </asp:updatepanel> </asp:content>
and here code behind:
protected void fileuploadcomplete(object sender, eventargs e) { if (fileupload1.hasfile) { string importname = server.mappath(@"uploads\") + fileupload1.filename; fileupload1.saveas(importname); // import jsa jsa jsa = new jsa(); jsa.import(importname); // show hyperlink showlink(); } } private void showlink() { openfile.attributes["style"] = string.empty; }
i didn't include master page code. has toolkitscriptmanager in it.
it more helpful if post of code have tried can better idea of are.
{first answer deleted}
[edit :i didn't catch using asyncfileupload when first read question]
using asyncfileupload inside update panel server being accessed via partial postback, result other controls (the hyperlink) cannot affected on server. require make use of javascript (or preferably jquery) make change on client.
Comments
Post a Comment