views:

13

answers:

1

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

+1  A: 

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>
Marko
There's a problem here, how can I find the id of "FileUploadControl"? Thanks
Vimvq1987