image not showing in grid view
ASP code
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.auto-style15 {
width: 91px;
}
.auto-style16 {
width: 91px;
height: 23px;
}
.auto-style17 {
height: 23px;
border: 2px solid #a1a1a1;
border-radius:5px;
margin-top:50px;
margin-left:300px;
padding-left:0;
}
.auto-style18 {
width: 235px;
}
.auto-style19 {
width: 235px;
height: 23px;
}
.auto-style20 {
width: 91px;
height: 26px;
}
.auto-style21 {
width: 235px;
height: 26px;
}
.auto-style22 {
width: 91px;
height: 37px;
}
.auto-style23 {
width: 235px;
height: 37px;
margin-left: 40px;
}
.grid{
margin-left:150px;
margin-top:50px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table class="auto-style17">
<tr>
<td class="auto-style15" align="center">username</td>
<td class="auto-style18" >
<asp:TextBox ID="TextBox2" runat="server" Width="171px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style20" align="center">password</td>
<td class="auto-style21">
<asp:TextBox ID="TextBox3" runat="server" Width="171px" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style16" align="center">confirm mail</td>
<td class="auto-style19">
<asp:TextBox ID="TextBox4" runat="server" Width="171px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style15" align="center">upload image</td>
<td class="auto-style18">
<asp:FileUpload ID="FileUpload1" runat="server"/>
</td>
</tr>
<tr>
<td class="auto-style15"> </td>
<td class="auto-style18"> </td>
</tr>
<tr>
<td class="auto-style22"></td>
<td class="auto-style23">
<asp:Button ID="Button1" runat="server" Text="Submit" Width="65px" OnClick="Button1_Click1" />
<asp:Button ID="Button2" runat="server" style="margin-left: 14px" Text="Reset" />
</td>
</tr>
<tr>
<td class="auto-style22"> </td>
<td class="auto-style23">
<asp:Label ID="Label9" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="userid" DataSourceID="SqlDataSource1" Width="608px" CssClass="grid" AllowPaging="True" AllowSorting="True" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3">
<Columns>
<asp:BoundField DataField="userid" HeaderText="userid" InsertVisible="False" ReadOnly="True" SortExpression="userid" />
<asp:BoundField DataField="username" HeaderText="username" SortExpression="username" />
<asp:BoundField DataField="password" HeaderText="password" SortExpression="password" />
<asp:BoundField DataField="mail" HeaderText="mail" SortExpression="mail" />
<asp:BoundField DataField="imagename" HeaderText="imagename" SortExpression="imagename" />
<asp:ImageField DataImageUrlField="uploadimage" HeaderText="uploadimage">
<ControlStyle Width="70%" Height="70%"/>
</asp:ImageField>
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:prakashConnectionString %>" SelectCommand="SELECT * FROM [getezeeregister]"></asp:SqlDataSource>
</asp:Content>
//_________________C# code________________
public void GvBind()
{
SqlCommand cmd = new SqlCommand("select * from getezeeregister", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
GridView1.DataSource = dr;
}
protected void Button1_Click1(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string pathName = "userimage/" + Path.GetFileName(FileUpload1.PostedFile.FileName);
string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
SqlCommand cmd = new SqlCommand("insert into getezeeregister(username,password,mail,imagename,uploadimage) values ('" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + filename + "','"+pathName+"')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
FileUpload1.SaveAs(Server.MapPath("~/userimage/"+FileUpload1.FileName));
ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Registered successfully..!! ');", true);
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Please select a file to upload ');", true);
}
}