Monday, 16 November 2015

genrate dinamic slider using aps.net C# with css and JS (wowslider)


// get css from wowslider
// get JS from wowslider



protected void generate_slider()
    {
        string paths = Server.MapPath("FolderName");
        DirectoryInfo d = new DirectoryInfo(paths);
        FileInfo[] Files = d.GetFiles("*");
        HtmlImage img;
        HtmlGenericControl li;
        foreach (FileInfo file in Files)
        {
            string filename = file.Name;// file name find
            string[] str = filename.Split('_');// split with your condtion
            if (str[0] == "check id condition here")
            {
                li = new HtmlGenericControl("li");
                img = new HtmlImage();
                img.Src = "Photo Gallery/" + filename;
                img.Style.Add("min-height:50px; max-height:250px; min-width", "20%");
                img.Alt = "";
                img.ID = str[0] + "" + str[1];
                li.Controls.Add(img);
                sliderid.Controls.Add(li); 
//add htmlgenericcontrol with server control here 'sliderid= server control id'
            }

        }

// reference

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...