【问题标题】:Display editbox and button on one gridview's cell in edit mode?在编辑模式下在一个gridview单元格上显示编辑框和按钮?
【发布时间】:2010-08-08 08:48:39
【问题描述】:

我有一个网格视图来显示数据,其中一列是文件路径(字符串)。我想在切换到编辑模式时,此列将是一个编辑框+一个按钮,(因此如果用户单击该按钮,将显示一个 OpenFileDialog 并且他可以选择一个新文件)

我该怎么做?

提前致谢

【问题讨论】:

    标签: .net asp.net css gridview


    【解决方案1】:

    您可以使用模板字段

    <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>
    

    【讨论】:

    • 这里有个问题,如何找到“FileUploadControl”的id?谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-08
    • 2019-12-03
    • 1970-01-01
    • 2023-03-20
    • 1970-01-01
    相关资源
    最近更新 更多