How to add files from different input controls into gridview
Below is my requirement. I will have two browse buttons on the page , and two upload buttons on the page.
My requirement is to have both the attachments uploaded by the user to be displayed in a gridview in one row.
Upload1 and Upload2 are the two attachments uploaded by the user a开发者_如何学编程nd i need to get them as below in the gridview.
Attachment 1 Attachment 2 Delete
Upload1 Upload2 Delete
Can you please help me with an easy way to achieve this?
If I understand you correctly you should be able to do this by using a TemplateField when you define your columns:
<Columns>
<asp:TemplateField HeaderText="FirstColumn">
<ItemTemplate>
<asp:FileUpload ID="fu_FirstFile" runat="server" /><br/>
<asp:Button ID="btn_UPloadFirst" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SecondCOlumn">
<ItemTemplate>
<asp:FileUpload ID="fu_SecondFile" runat="server" /><br/>
<asp:Button ID="btn_UPloadSecond" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
精彩评论