Asp.net 文件上载在网格视图和Ajax更新面板中不起作用
我想在网格视图和Ajax更新面板中上传一个文件。但是,我认为文件上传工具不能在Ajax更新面板中发回 我使用了触发方法,但它不起作用!有人能帮我吗 代码隐藏:Asp.net 文件上载在网格视图和Ajax更新面板中不起作用,asp.net,ajax,file-upload,Asp.net,Ajax,File Upload,我想在网格视图和Ajax更新面板中上传一个文件。但是,我认为文件上传工具不能在Ajax更新面板中发回 我使用了触发方法,但它不起作用!有人能帮我吗 代码隐藏: if (((FileUpload)GridView1.Rows[0].Cells[0].FindControl("FileUpload1") as FileUpload).HasFile) { /////My stuffs } <asp:GridView ID="GridView1" runat="server" Auto
if (((FileUpload)GridView1.Rows[0].Cells[0].FindControl("FileUpload1") as FileUpload).HasFile)
{
/////My stuffs
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" onrowdatabound="GridView1_RowDataBound"
DataKeyNames="ID,ArticleID,UserName" DataSourceID="SqlDataSource1"
GridLines="Vertical" AllowPaging="True" PageSize="5">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table style="width: 100%;">
....//Other Stuffs
</table>
<%-- </asp:UpdatePanel>--%>
</div>
</article>
</div>
</section>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td class="auto-style1"> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<Triggers>
<asp:PostBackTrigger ControlID="FileUpload1" />
</Triggers>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
HTML代码:
if (((FileUpload)GridView1.Rows[0].Cells[0].FindControl("FileUpload1") as FileUpload).HasFile)
{
/////My stuffs
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" onrowdatabound="GridView1_RowDataBound"
DataKeyNames="ID,ArticleID,UserName" DataSourceID="SqlDataSource1"
GridLines="Vertical" AllowPaging="True" PageSize="5">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table style="width: 100%;">
....//Other Stuffs
</table>
<%-- </asp:UpdatePanel>--%>
</div>
</article>
</div>
</section>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td class="auto-style1"> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<Triggers>
<asp:PostBackTrigger ControlID="FileUpload1" />
</Triggers>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
..//其他资料
就像你写的代码一样,它不起作用,试试这个
<Triggers>
<asp:PostBackTrigger ControlID="Gridview1" />
</Triggers>
谢谢,它很好用。但是,更新进度Ajax工具现在无法工作!(我显示了加载时间)有没有办法让文件上传和更新进度同时工作?