Click here to Skip to main content
15,041,525 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
Please can anyone help me for this .
I am displaying image files in the gridview .
On EDIT button click i have displayed Fileupload Control to change the image.
But when i Click on the update button the file name is lost.
What should i do for this ?
Thank you very much in Advance for reply.

<asp:GridView ID="gridnewsletter" runat="server" AutoGenerateColumns="False"
         DataSourceID="LinqDataSource1" AutoGenerateDeleteButton="True"
         AutoGenerateEditButton="True" CellSpacing="2"
         onrowupdating="gridnewsletter_RowUpdating" BackColor="#DEBA84"
         BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
         DataKeyNames="NewsLetterId" onrowcommand="gridnewsletter_RowCommand1">
         <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
         <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
         <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
         <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
         <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
           <asp:TemplateField HeaderText="PhotoPath" SortExpression="PhotoPath">
                 <asp:FileUpload ID="fileuploadnews"  runat="server" EnableViewState="True" /></td>
                   <asp:HiddenField ID="HiddenField1" runat="server" />
                     <asp:Label ID="lbl" runat="server" Text="Label"></asp:Label></td>
                   <asp:Image ID="Image1" runat="server" ImageUrl='<%# Bind("PhotoPath<code></code>") %>' Height="100" Width="100" />
           <asp:TemplateField HeaderText="Title" SortExpression="Title">
                   <asp:TextBox ID="txttitle" runat="server" TextMode="MultiLine"  Text='<%# Bind("Title") %>'></asp:TextBox>
                   <asp:Label ID="Label1" runat="server" Text='<%# Bind("Title") %>'></asp:Label>
           <asp:TemplateField HeaderText="Description" SortExpression="Description">
            <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Text='<%# Bind("Description") %>' ></asp:TextBox>
                   <asp:Label ID="Label2" runat="server" Text='<%# Bind("Description") %>'></asp:Label>
Updated 26-Oct-10 22:58pm
m@dhu 27-Oct-10 4:59am
edited code block.
Sunasara Imdadhusen 27-Oct-10 5:19am
Please provide server side code also

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900