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" %>
$(document).ready(function () {
$('#slider_image').cycle({
fx: 'fade',
speed: 2500
});
}
);





Wedding
RepeatDirection="Horizontal" onselectedindexchanged="Page_Load">
<%# DataBinder.Eval(Container.DataItem,"d_code") %>/><%# DataBinder.Eval(Container.DataItem,"d_name") %> |
$<%# DataBinder.Eval(Container.DataItem,"d_price") %> |
Arabic
RepeatDirection="Horizontal" CssClass=tab
onselectedindexchanged="Page_Load">
<%# DataBinder.Eval(Container.DataItem,"d_code") %>/><%# DataBinder.Eval(Container.DataItem,"d_name") %> |
$<%# DataBinder.Eval(Container.DataItem,"d_price") %> |
Tattoo
RepeatDirection="Horizontal">
<%# DataBinder.Eval(Container.DataItem,"d_code") %>/><%# DataBinder.Eval(Container.DataItem,"d_name") %> |
$<%# DataBinder.Eval(Container.DataItem,"d_price") %> |
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();
}
}
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
jemin patelPosted Sep 27, 2017, 3:04 AM
Manas MohapatraPosted Sep 26, 2017, 6:34 AM