我想在网格视图和Ajax更新面板中上传文件。但是,我认为文件上传工具无法在Ajax更新面板中回发。
我使用了触发器方法,但它没有用!任何人都可以帮助我吗?
代码背后:
if (((FileUpload)GridView1.Rows[0].Cells[0].FindControl("FileUpload1") as FileUpload).HasFile)
{
/////My stuffs
}
HTML code:
<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>
答案 0 :(得分:2)
<Triggers>
<asp:PostBackTrigger ControlID="Gridview1" />
</Triggers>