Reputation: 2046
I want to upload a file inside a grid view and Ajax update panel. However, I think the file Upload tool can not post back inside an Ajax update panel.
I have used the trigger method, but it did not work! Can any body help me?
Code Behind:
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>
Upvotes: 1
Views: 1439
Reputation: 144
like what u wrote the code it won't work Just try this
<Triggers>
<asp:PostBackTrigger ControlID="Gridview1" />
</Triggers>
Upvotes: 2