Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
actually iam working with image slide show what i want is

actually iam uploading images using fileuploadcontrol when iam uploading its uploading but when iam making image slide show there the problem occurs

I have three fields id,name,img when i insert images with the same name as image name the image is sliding for ex my img name is ram.jpg if ienter the name in txtname as ram.jpg the image is sliding but if i put the txtname as ram no image coming"
so below is code

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class sldeshow : System.Web.UI.Page
{
    static DataTable dt;
    static int TotalRecords, CurrentRecord;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            string sqlconstr = "Data Source=HOME;Initial Catalog=Registration;Integrated Security=True";
            SqlConnection con = new SqlConnection(sqlconstr);
            SqlDataAdapter sqlda = new SqlDataAdapter("select * from imagepath where CurrentDate is NULL union ALL select * from imagepath where convert(varchar(20), CurrentDate, 101) = convert(varchar(20), getdate(), 101)", con);
            dt = new DataTable();
            sqlda.Fill(dt);
            TotalRecords = dt.Rows.Count;
            Image1.ImageUrl = "~/Upload/" + dt.Rows[0]["ImageName"].ToString();

        }
    }
    protected void Timer11_Tick(object sender, EventArgs e)
    {
        CurrentRecord++;
        if (CurrentRecord == TotalRecords)
        {
            CurrentRecord = 0;
        }
        Image1.ImageUrl = "~/Upload/" + dt.Rows[CurrentRecord]["ImageName"].ToString();
    }
Posted
Updated 30-Jun-15 20:50pm
v2
Comments
F-ES Sitecore 1-Jul-15 7:22am    
You need to specify the extension too. "image" isn't a valid url, it needs "image.jpg" or whatever.
manognya kota 3-Jul-15 7:31am    
how are you uploading? i mean as to what columns are stored wrt text box?
and on what basis are you retrieving?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900