Display editbox and button on one gridview's cell in edit mode?
I have a gridview to display data, and one of columns was the file path (string). I want to when switch to edit mode, this column will be a editbox + a button, (so if the user click on the button, an OpenFileDialog will be show and he can select a new file)
How can I do开发者_如何转开发 that?
Thanks in advance
You can use a TemplateField
<asp:TemplateField HeaderText="FilePath" SortExpression="FilePath">
<EditItemTemplate>
<asp:FileUpload id="FileUploadControl" runat="server" />
<asp:Button runat="server" id="UploadButton" text="Upload" onclick="UploadButton_Click" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="filePathLabel" runat="server" Text='<%# Bind("FilePath") %>' />
</ItemTemplate>
</asp:TemplateField>
精彩评论