c# - Fileupload in gridview edittemplate not working in update panel -


i have fileupload control inside gridview edittemplate:

 <asp:templatefield headertext="template file" itemstyle-horizontalalign="left">                                                                     <itemtemplate>                                                                         <asp:label id="lbltemplatefilename" runat="server" text='<%# eval("templatefilename")%>'></asp:label>                                                                     </itemtemplate>                                                                     <edititemtemplate>                                                                          <asp:fileupload id="futemplate" runat="server" />                                                                         <asp:requiredfieldvalidator id="rftemplatefile" display="dynamic" controltovalidate="futemplate"                                                                             runat="server" errormessage="select template file!" validationgroup="grd"                                                                             text="*" forecolor="red"></asp:requiredfieldvalidator>                                                                      </edititemtemplate>                                                                 </asp:templatefield> 

gridview inside update panel:

<asp:updatepanel id="upmain" runat="server" updatemode="conditional">     <contenttemplate> ............... .............. </contenttemplate>  </asp:updatepanel> 

when through rowcommand check fileuploader.hasfile , , shows false although has file.

i tried having postbacktrigger grid fileuploader.

but not of use.

how can deal problem?

please guide me.

have tried adding :

page.form.attributes.add("enctype", "multipart/form-data"); 

on page load

file upload not work partial post back. add line @ page load

scriptmanager.getcurrent(this).registerpostbackcontrol(this.yourgridviewid); 

or use postbacktrigger.

<triggers>             <asp:postbacktrigger controlid="yourgridviewid" /> </triggers> 

or need special asyncfileupload control defined in ajaxcontrol toolkit.

<ajaxtoolkit:asyncfileupload onclientuploaderror="uploaderror"      onclientuploadcomplete="uploadcomplete" runat="server"      id="asyncfileupload1" width="400px" uploaderstyle="modern"      uploadingbackcolor="#ccffff" throbberid="mythrobber" /> 

you can check here.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -