jemin patel

jemin patel

  • NA
  • 18
  • 2.7k

Display Image issue

Sep 26 2017 3:47 AM
in my website i insert image from admin side and display that image to clinte side in ie 11 it working good but in chrome Version 61.0.3163.100 and firefox it not display any image the image in clint side show in datalist view
 
the code to insert image in database(Admin site)
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
public partial class admin_insertdesign : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string un = txtname.Text;
string cat = ddlcate.SelectedItem.Value;
string dc = txtcode.Text;
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["cn"]);
con.Open();
String img = un + cat + ".jpg";
SqlCommand com = new SqlCommand("insert into design values('" + txtcode.Text + "','" + txtname.Text + "','" + ddlcate.SelectedItem.Value + "','" + ddlpart.SelectedItem.Value + "','" + txtprice.Text + "','" + FileUpload1.PostedFile.FileName + "')");
com.Connection = con;
com.ExecuteNonQuery();
String path = Server.MapPath("../heena");
FileUpload1.PostedFile.SaveAs(path + "/" + img);
Label1.Text = "upload";
txtname.Text = "";
txtcode.Text = "";
txtprice.Text = "";
}
}
 
The code to display image in (client site )aspx file
 
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="mainpage.aspx.cs" Inherits="mainpage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="htm.css" rel="stylesheet" type="text/css" />
<link href="zoom.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.cycle.all.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#slider_image').cycle({
fx: 'fade',
speed: 2500
});
}
);
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="container dark">
<div class="homewrap" id="top_div">
<div id="top_left">
</div>
<div id="top_right">
Mobile:98795------
</div>
<div id="clear"></div>
</div>
</div>
<div class="container light">
<div class="homewrap">
<div id="logo_left">
<img src="image/Tulsi Henna.png" />
</div>
<div id="logo_right">
<asp:TextBox ID="txtsearch" runat="server"></asp:TextBox>
<asp:Button ID="btn" runat="server" Text="search" />
</div>
</div>
<div id="clear"></div>
</div>
<div class="container ">
<div class="homewrap black">
<div id="slider_image">
<img src="image/img1.png" />
<img src="image/img2.png" />
<img src="image/img3.png" />
<img src="image/img4.png" />
</div>
</div>
</div>
<div class="container light" >
<div class="homewrap">
<div id="menu">
<ul>
<li><a href="mainpage.aspx">Home</a></li>
<li><a>Henna</a>
<ul>
<li><a href="mainweeding.aspx">Wedding</a></li>
<li><a href="mainarabic.aspx">Arabic</a></li>
<li><a href="maintattoo.aspx">Tattoo</a></li>
</ul></li>
<li><a href="signup.aspx">Signup</a></li>
<li><a href="Default.aspx">Login</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</div>
<h2>Wedding</h2>
<div class=" container ">
<div class=" homewrap">
<div id="Datalist">
<asp:DataList ID="DataList1" runat="server" RepeatColumns="4" CssClass="tab"
RepeatDirection="Horizontal" onselectedindexchanged="Page_Load">
<ItemTemplate>
<table class="container">
<tr>
<td>
<img class="img-rounded zoom" src="<%# DataBinder.Eval(Container.DataItem,"image") %>" >
</tr>
<tr align=center>
<td>
<%# DataBinder.Eval(Container.DataItem,"d_code") %>/<a href=ddetails.aspx?d_name=<%# DataBinder.Eval(Container.DataItem,"d_name") %>><%# DataBinder.Eval(Container.DataItem,"d_name") %></a></td>
</tr >
<tr align=center>
<td>
$<%# DataBinder.Eval(Container.DataItem,"d_price") %></td>
</tr>
<tr align=center>
<td>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</div>
</div>
<div class=" container ">
<div class=" homewrap">
<div id="Datalist">
</div>
</div>
</div>
<h2>Arabic</h2>
<div class="container ">
<div class="homewrap">
<div id="Datalist">
<asp:DataList ID="DataList2" runat="server" RepeatColumns="4"
RepeatDirection="Horizontal" CssClass=tab
onselectedindexchanged="Page_Load">
<ItemTemplate>
<table class="container" >
<tr>
<td>
<img class="img-rounded zoom" src=" <%# DataBinder.Eval(Container.DataItem,"image") %>" width=300 height=300></a></td>
</tr>
<tr align=center>
<td>
<%# DataBinder.Eval(Container.DataItem,"d_code") %>/<a href=ddetails.aspx?d_name=<%# DataBinder.Eval(Container.DataItem,"d_name") %>><%# DataBinder.Eval(Container.DataItem,"d_name") %></a></td>
</tr >
<tr align=center>
<td>
$<%# DataBinder.Eval(Container.DataItem,"d_price") %></td>
</tr>
<tr align=center>
<td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</div>
</div>
<h2>Tattoo</h2>
<div class="container ">
<div class="homewrap">
<div id="Datalist">
<asp:DataList ID="DataList3" runat="server" RepeatColumns="4" CssClass=tab
RepeatDirection="Horizontal">
<ItemTemplate>
<table class="container">
<tr>
<td>
<img class="img-rounded zoom" runat="server" src= <%# DataBinder.Eval(Container.DataItem,"image") %> width=300 height=300></a></td>
</tr>
<tr align=center>
<td>
<%# DataBinder.Eval(Container.DataItem,"d_code") %>/<a href=ddetails.aspx?d_name=<%# DataBinder.Eval(Container.DataItem,"d_name") %>><%# DataBinder.Eval(Container.DataItem,"d_name") %></a></td>
</tr >
<tr align=center>
<td>
$<%# DataBinder.Eval(Container.DataItem,"d_price") %></td>
</tr>
<tr align=center>
<td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</div>
</div>
<div class="container dark" >
<div class="wrapper">
<div id="footer_section">
<h4>Our Policy</h4>
<ul>
<li><a href="#"> Cancallation </a></li>
<li><a href="#"> Payment </a></li>
<li><a href="#"> Tearm & Condition </a></li>
</ul>
</div>
<div id="footer_section">
<h4>Our Policy</h4>
<ul>
<li><a href="#"> Cancallation </a></li>
<li><a href="#"> Payment </a></li>
<li><a href="#"> Tearm & Condition </a></li>
</ul>
</div>
<div id="footer_section">
<h4>Our Policy</h4>
<ul>
<li><a href="#"> Cancallation </a></li>
<li><a href="#"> Payment </a></li>
<li><a href="#"> Tearm & Condition </a></li>
</ul>
</div>
<div id="footer_section">
<h4>Social</h4>
<ul>
<li><a href="#"><img src="image/icon2.png" /> Twitter </a></li>
<li><a href="#"><img src="image/icon1.png" /> Facebook </a></li>
<li><a href="#"><img src="image/icon3.png" /> Linked.in </a></li>
</ul>
</div>
<div >
</div>
</div>
</div>
</form>
</body>
</html>
ASPX.cs File 
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
public partial class mainpage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["cn"]);
con.Open();
SqlDataAdapter da = new SqlDataAdapter("SELECT top(8) d_category,image,d_code,d_name,d_price FROM design where d_category='Wedding' Order By d_id DESC", con);
DataSet ds = new DataSet();
da.Fill(ds, "src");
DataList1.DataSource = ds.Tables[0];
DataList1.DataBind();
SqlDataAdapter sda = new SqlDataAdapter("SELECT top(8) d_category,image,d_code,d_name,d_price FROM design where d_category='Arabic' Order By d_id DESC", con);
DataSet das = new DataSet();
sda.Fill(das, "sc");
DataList2.DataSource = das.Tables[0];
DataList2.DataBind();
SqlDataAdapter sd = new SqlDataAdapter("SELECT top(8) d_category,image,d_code,d_name,d_price FROM design where d_category='tattoo' Order By d_id DESC", con);
DataSet dat = new DataSet();
sd.Fill(dat, "s");
DataList3.DataSource = dat.Tables[0];
DataList3.DataBind();
}
}
 
 
 
 
 
 

Answers (2)