Use fileupload as template field in a details view

Posted by MyHeadHurts on Stack Overflow See other posts from Stack Overflow or by MyHeadHurts
Published on 2010-12-30T16:07:28Z Indexed on 2011/01/06 9:54 UTC
Read the original article Hit count: 272

Filed under:
|

I have an admin page where a user will select a document path and add that path to a certain column of a database. I am using a fileupload on the page where they can find the document and copy the path and then paste it into the details view. However, I want to skip this step and I want them to select a document and automatically make the path show up in the details view.

  <asp:FileUpload ID="FileUpload1" runat="server" Visible="False" Width="384px" /><br />
        <br />
        <div>
          <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

                <ContentTemplate>
                     <center>   <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
                        DataKeyNames="ID" DataSourceID="SqlDataSource1" Height="128px" Width="544px" Visible="False" OnModeChanged="Button2_Click" CellPadding="4" ForeColor="#333333" GridLines="None" >
                        <Fields>
                                                    <asp:BoundField DataField="Order" HeaderText="Order" SortExpression="Order" />
                            <asp:BoundField DataField="Department" HeaderText="Department" SortExpression="Department"/>
                            <asp:BoundField DataField="DOC_Type" HeaderText="DOC_Type" SortExpression="DOC_Type" />
                            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                            <asp:BoundField DataField="Revision" HeaderText="Revision" SortExpression="Revision" />
                            <asp:BoundField DataField="DOC" HeaderText="DOC" SortExpression="DOC" />
                            <asp:BoundField DataField="Active" HeaderText="Active" SortExpression="Active" />
                            <asp:BoundField DataField="Rev_Date" HeaderText="Rev_Date" SortExpression="Rev_Date" />
                            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                                SortExpression="ID" Visible="False" />
                            <asp:CommandField ShowInsertButton="True" />
                        </Fields>
                        <FooterStyle BackColor="#5D7B9D" BorderStyle="None" Font-Bold="True" ForeColor="White" />
                        <CommandRowStyle BackColor="#E2DED6" BorderStyle="None" Font-Bold="True" />
                        <RowStyle BackColor="#F7F6F3" BorderStyle="None" ForeColor="#333333" />
                        <FieldHeaderStyle BackColor="#E9ECF1" BorderStyle="None" Font-Bold="True" />
                        <EmptyDataRowStyle BorderStyle="None" />
                        <PagerStyle BackColor="#284775" BorderStyle="None" ForeColor="White" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="#5D7B9D" BorderStyle="None" Font-Bold="True" ForeColor="White" />
                        <InsertRowStyle BorderStyle="None" />
                        <EditRowStyle BackColor="#999999" BorderStyle="None" />
                        <AlternatingRowStyle BackColor="White" BorderStyle="None" ForeColor="#284775" />
                    </asp:DetailsView>
                         &nbsp;
                    <br />

I need to get the fileupload1 into the DOC contenttemplate area so instead of showing an empty textbox it will show just a textbox it will show the fileupload alt text

alt text

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vb.net