I think my explanation is not clear to u
Lets take a example
Requirement :
1. There is one gridview
2. It must have edit/delete button in every row
AutoGenerateEditButton="True"
using this in gridview.
3. When user click in the edit button the entire row (Where user click) shows the update and cancel button and grid opened in editable mode. According to my grid it have two fileupload option
My grid is
<asp:GridView ID="gdvstudent" runat="server" AutoGenerateColumns="False" AutoGenerateEditButton="True"
CellPadding="4" AllowSorting="True" OnSorting="gdvstudent_Sorting" ForeColor="#333333"
ShowFooter="true" SortedAscendingCellStyle-BackColor="Blue" HorizontalAlign="Center"
AllowPaging="True" PageSize="5" Width="754px">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField HeaderText="Student Name" SortExpression="txt_student_name">
<ItemTemplate>
<%#Eval("txt_student_name")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtStudentName" runat="server" Text='<%#Eval("txt_student_name")%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Student Roll" SortExpression="txt_student_roll">
<ItemTemplate>
<%#Eval("txt_student_roll")%></ItemTemplate>
<EditItemTemplate>
<asp:Label ID="txtstudentroll" runat="server" Text='<%#Eval("txt_student_roll")%>'></asp:Label>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Student class" SortExpression="txt_student_class">
<ItemTemplate>
<%#Eval("txt_student_class")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtstudentclass" runat="server" Text='<%#Eval("txt_student_class")%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Student Marks" SortExpression="txt_student_marks">
<ItemTemplate>
<%#Eval("txt_student_marks")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtstudentmarks" runat="server" Text='<%#Eval("txt_student_marks")%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Student DOB" SortExpression="txt_student_dob">
<ItemTemplate>
<%#Eval("txt_student_dob")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtstudentdob" runat="server" Text='<%#Eval("txt_student_dob")%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Student Resume">
<ItemTemplate>
<asp:LinkButton runat="server" ID="student_resume" CommandArgument='<%# Bind("student_resume") %>'
Visible="false" OnClick="DownloadFile" Text="Resume">
</asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:FileUpload ID="fileupload" FileName='<%# Bind("student_resume") %>' runat="server">
</asp:FileUpload>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Student Picture">
<ItemTemplate>
<asp:Image runat="server" ID="student_Pic" ImageUrl="~/frmImagePrev.aspx" ImageAlign="Middle" AlternateText="Insert Picture"></asp:Image>
</ItemTemplate>
<EditItemTemplate>
<asp:FileUpload ID="fileupload1" FileName='<%# Bind("student_pic") %>' runat="server">
</asp:FileUpload>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edited" Visible="False">
<ItemTemplate>
<asp:CheckBox ID="ChkboxEdit" runat="server" Checked='<%#Eval("edited")%>' />
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="ChkboxEdit" runat="server" Checked='<%#Eval("edited")%>' />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<SortedAscendingCellStyle BackColor="Azure" />
<SortedAscendingHeaderStyle BackColor="Aqua" />
<SortedDescendingCellStyle BackColor="Blue" />
<SortedDescendingHeaderStyle BackColor="BlueViolet" />
</asp:GridView>
One for the resume upload and one for picture upload.
When user updated the information and upload its resume and picture and hit in the upload button the row again come back to select mode and the respective cell in that row where picture has been uploaded shows the picture.
4. The picture must not save in the database or in physical path while uploading / editing.
Clarification:
1. I don't want to save the image in session. Because all of my experiment gone into vain so i decide to make an item template like this
<asp:templatefield headertext="Student Picture" xmlns:asp="#unknown">
<itemtemplate>
<asp:image runat="server" id="student_Pic" imageurl="~/frmImagePrev.aspx" imagealign="Middle" alternatetext="Insert Picture"></asp:image>
</itemtemplate>
<edititemtemplate>
<asp:fileupload id="fileupload1" filename="<%# Bind("student_pic") %>" runat="server">
</asp:fileupload>
</edititemtemplate>
</asp:templatefield>
here
ImageUrl="~/frmImagePrev.aspx"
line redirect in the
frmImagePrev.aspx
page and then it shows the picture in all the cells throughout the grid view.
Write now i am stuck here.
2. but this is my approach i need to achieve the goal not the approach.
I think i am clear now what i need. If more explanation needed i am happy to give u it full code is needed pls give me the mail id i can send it to you.
Thanking you : Tanmoy (INDIA)