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.

XML
<asp:GridView ID="gridnewsletter" runat="server" AutoGenerateColumns="False"
         CellPadding="3"
         DataSourceID="LinqDataSource1" AutoGenerateDeleteButton="True"
         AutoGenerateEditButton="True" CellSpacing="2"
         onrowediting="gridnewsletter_RowEditing"
         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" />
            <Columns>
           <asp:TemplateField HeaderText="PhotoPath" SortExpression="PhotoPath">
               <EditItemTemplate>
                 <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>
                </EditItemTemplate>
               <ItemTemplate>
                   <asp:Image ID="Image1" runat="server" ImageUrl='<%# Bind("PhotoPath<code></code>") %>' Height="100" Width="100" />
               </ItemTemplate>
           </asp:TemplateField>
           <asp:TemplateField HeaderText="Title" SortExpression="Title">
               <EditItemTemplate>
                   <asp:TextBox ID="txttitle" runat="server" TextMode="MultiLine"  Text='<%# Bind("Title") %>'></asp:TextBox>
               </EditItemTemplate>
               <ItemTemplate>
                   <asp:Label ID="Label1" runat="server" Text='<%# Bind("Title") %>'></asp:Label>
               </ItemTemplate>
           </asp:TemplateField>
           <asp:TemplateField HeaderText="Description" SortExpression="Description">
               <EditItemTemplate>
            <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Text='<%# Bind("Description") %>' ></asp:TextBox>
               </EditItemTemplate>
               <ItemTemplate>
                   <asp:Label ID="Label2" runat="server" Text='<%# Bind("Description") %>'></asp:Label>
               </ItemTemplate>
           </asp:TemplateField>
       </Columns>
     </asp:GridView>
Posted
Updated 26-Oct-10 22:58pm
v2
Comments
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