How to display image in grid view..
1 . upload image in database ...file name.
2.image file save in created folder...
3-in grid view show only file name...
after edited column in grid view ...Imagefield name...imagefileurl...databasefile name..
At the end its not show image...
please guide...

Vindhya YadaavPosted Oct 29, 2015, 3:25 AM
Munesh SharmaPosted Oct 28, 2015, 3:22 AM
Rupali ShindePosted Oct 28, 2015, 12:54 AM
Font-Names = "Arial" Caption = "Using ImageControl" >
<Columns>
<asp:BoundField DataField = "ID" HeaderText = "ID" />
<asp:BoundField DataField = "Name" HeaderText = "Image Name" />
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="Image1" Height = "100" Width = "100" runat="server"
ImageUrl = '' />
ItemTemplate>
asp:TemplateField>
Columns>
asp:GridView>
DataTable dt = new DataTable();
String strConnString = System.Configuration.ConfigurationManager.
ConnectionStrings["conString"].ConnectionString;
string strQuery = "select ID, Name from tblFiles order by ID";
SqlCommand cmd = new SqlCommand(strQuery);
SqlConnection con = new SqlConnection(strConnString);
SqlDataAdapter sda = new SqlDataAdapter();
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
try
{
con.Open();
sda.SelectCommand = cmd;
sda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
GridView2.DataSource = dt;
GridView2.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
Rajeesh MenothPosted Oct 27, 2015, 7:31 AM
Jitendra KumarPosted Oct 27, 2015, 7:24 AM