I am showing the images in background. The images which name contains blank spaces do not appear on the page. Other images without a space appear just fine.
My code is given below:
<asp:Repeater ID="rptImages" runat="server">
<ItemTemplate>
<div style="background-image:url(pages/<%#Eval("Image")%>)" title="<%#Eval("SubFolder1")%>">
</div>
</ItemTemplate>
</asp:Repeater>
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["SqlConn"].ToString());
string catId;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
getSubFolder1();
}
}
protected void getSubFolder1()
{
DataSet ds = new DataSet();
string str = "select * from SubCategory where IsActive=0";
SqlDataAdapter da = new SqlDataAdapter(str, con);
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
rptImages.DataSource = ds;
rptImages.DataBind();
}
}
How will show those images in background which image name contains spaces.Grateful for any advice.