南通最专业的开锁公司 南通最好的开锁公司 君威遥控器电池 君威专用汽车钥匙电池雷诺科雷傲汽车钥匙遥控器电池更换方法 南通开锁公司电话_南通修锁 换锁芯 开汽车锁 崇川区 港闸区 如皋 如东开锁 南通开锁公司电话 南通金钥匙开锁服务部-专业开修锁 换锁芯(正规公安工商备案) 南通开锁公司电话 南通开锁公司修锁 装锁电话|崇川区开锁|港闸区开锁 led吸顶灯光源 吸顶灯32w 吸顶灯 灯管 吸顶灯 节能灯泡 led吸顶灯灯泡 三头吸顶灯 led吸顶灯灯管 欧普圆形吸顶灯 55w吸顶灯 吸顶灯光源 旅游壶 真空保温 汉方养生壶 美的电热水壶15s08a2 半球牌电饭煲 美的 mg123-d hd2 飞科 三洋洗衣机全自动 新安怡 学饮杯 黑苦荞黄酮软胶囊 苦荞糖安胶囊 五彩凉山苦荞茶 苦荞茶250g 全胚芽黑苦荞茶500 内蒙特产苦荞茶 富贵康苦荞茶 苦荞面包邮 正中苦荞茶包邮 正中苦荞茶 包邮 苦荞香茶西部 苦荞香茶 西部 轩庆苦荞玫瑰鲜花饼 苦荞真空 苦荞500克 苦荞茶120 苦荞 真空 0.02安全套包邮0.2大力马鱼线0.4mm0.4鱼线0.5l氮纤维高压瓶007sh充电器007电子请柬00高达xn-raiser01102400018401背囊0-25微米千分尺03g101系列全套图集0-3个月婴儿连体哈衣05-08本田奥德赛05ffc23套机05版河南动感地带0603贴片电阻包06年款英派斯06斯巴鲁森林人cd机07军衔07军用水壶07款福克斯两厢07数码迷彩07速腾大灯总成 泰好大门锁 泰好豪华大门锁 cei超b级锁芯 玻璃橱门锁 指纹锁耶鲁4109 耶鲁凯特曼指纹锁 防盗挂锁包邮 包挂锁 包梁挂锁 新君威门锁 新君威门锁扣 指纹锁木门 太空铝黑色门锁 泰好浴室铜门锁 浴室门锁不锈钢 1178冷库门锁 南通配新桑塔纳2000 3000 时代超人 志俊汽车钥匙_配帕桑塔纳钥匙遥控器_帕萨特钥匙全丢重配崇川区 南通配宝来汽车钥匙_配宝来遥控器_宝来钥匙全丢如皋 南通配帕萨特汽车钥匙_配帕萨特遥控器_帕萨特钥匙全丢通州 南通配凯越汽车钥匙_配凯越遥控器_凯越钥匙全丢如东

  • 格子衬衣女 长袖 秋
  • t男恤 短袖 韩版包邮
  • 男士职业衬衫
  • 衬衫 女 长袖点点
  • 衬衫 素色 男 宽松 休闲
  • 职场气质衬衫女
  • t恤男短袖加大码不掉色
  • 帅T 小西装
  • 裤子棕色长裤男
  • 衬衣 女 灯芯绒
  • 衬衣 女商务
  • 女士职业衬衫短袖
  • 休闲裤 男 修身
  • jamesearl纯棉休闲长裤
  • 占姆士女式长袖衬衫
  • 男黑色商务休闲棉长裤
  • 女士长袖衬衫
  • 男士绿色休闲长裤
  • 全棉短袖衬衫 男 薄
  • 女士长袖纯棉衬衫
  • 秋裤男直筒
  • 马自达3汽车挂件吊坠饰品 高档琉璃汽车挂饰品蒙迪欧致胜汽车挂件吊坠饰品 高档琉璃汽车挂饰品 启辰D50汽车挂件吊坠饰品 高档琉璃汽车挂饰品起亚K2汽车挂件吊坠饰品 高档琉璃汽车挂饰品索纳塔汽车挂件吊坠饰品 高档琉璃汽车挂饰品天籁汽车挂件吊坠饰品 高档琉璃汽车挂饰品 天语SX4汽车挂件吊坠饰品 高档琉璃汽车挂饰品英朗GT汽车挂件吊坠饰品 高档琉璃汽车挂饰品英伦SC7汽车挂件吊坠饰品 高档琉璃汽车挂饰品自由舰汽车挂件吊坠饰品 高档琉璃汽车挂饰品雨燕汽车挂件吊坠饰品 高档琉璃汽车挂饰品雪佛兰迈锐宝汽车挂件吊坠饰品 高档琉璃汽车挂饰品

    秋冬季现代瑞纳 宝马5系 帕萨特 日产骐达专用汽车毛绒方向盘套 江苏省盐城市地图2014 最新版 江苏省卫星地图2014 最新版 百度地图-谷歌地图-中国地图-北京地图-搜狗地图google地图 广本凌派汽车座垫 凌派秋冬季汽车坐垫 四季通用 长安福特福克斯油耗详解 宝来汽车遥控钥匙电池 更换方法 图解宝来遥控钥匙的电池换法 宝骏630车钥匙遥控器电池更换步骤 更换方法 迈腾车钥匙电池 迈腾更换遥控器电池详解逍客汽车钥匙电池 遥控器逍客智能钥匙的电池更换步骤 新天籁智能遥控钥匙电池 新天籁智能钥匙如何更换纽扣电池 golf6 汽车钥匙遥控器换电池 图解高尔夫6遥控钥匙的电池换法 长安福特福克斯加速时间详解[图] 福克斯汽车钥匙电池 福克斯钥匙电池更换作业 Q5车钥匙更换电池方法 图解新凯越车钥匙更换电池
  • 汽车坐垫 可爱
  • wrc汽车坐垫
  • 汽车坐垫套四季通用
  • 明锐冰丝 汽车坐套
  • 骐达汽车脚垫全包围
  • 三菱蓝瑟汽车坐垫
  • 捷达汽车脚垫 3d
  • 奥迪S7坐垫
  • 别克荣御坐垫
  • Jeep指南者坐垫
  • 力帆320坐垫
  • 路虎卫士坐垫
  • 双龙爱腾坐垫
  • 斯柯达Yeti坐垫
  • 现代途胜坐垫
  • 一汽威乐坐垫
  • 哈飞路宝汽车坐垫
  • 吉利远景汽车坐垫
  • 吉利全球鹰汽车坐垫
  • 房门锁执手锁 防盗挂锁
  • 运动短裤
  • 短裤 男
  • 半裙
  • 手工拖鞋鞋底
  • iphone4皮套 手机套
  • 机油滤清器扳手工具
  • 桑塔纳3000机油
  • 家居摆件现代
  • 玻璃摆件
  • 瓷器摆件
  • 马到成功摆件
  • 高档瓷器摆件
  • 宝马山地自行车包邮
  • 根雕工艺品摆件
  • 家居摆件吊脚娃娃
  • 泰国佛像摆件工艺品
  • 美利达儿童自行车
  • 天鹅摆件结婚
  • 龙龟摆件纯铜
  • 金摆件聚宝盆
  • 亲子自行车 女式
  • 客厅卧室装饰摆件
  • 贵宾狗摆件
  • 木摆件
  • 羚羊头摆件
  • 招财兔摆件
  • 自行车前包
  • 牛仔短裤
  • 短裤 男 休闲
  • 高腰短裤
  • 夏季短裤
  • 蕾丝短裤
  • 连体短裤
  • 裙裤
  • 裤裙
  • 拖鞋 海外
  • 拖鞋 浴室
  • 拖鞋 防滑
  • 拖 鞋 男
  • 拖鞋 女
  • 浴室拖鞋
  • 家居拖鞋
  • 凉拖鞋
  • 夏天拖鞋
  • 香菇丸
  • 韩国饮料
  • 打草绳小松打草绳二手挖掘机小松 小松割灌机配件 钢木书桌办公桌钢木桌玻璃杯子水壶钢化玻璃水壶钢木办公桌钢木电脑桌进口玻璃水壶玻璃水成份防冻玻璃水包邮防冻玻璃水车用 环保果皮箱环保垃圾袋环保垃圾桶小松120-6常州小松割草机小松打草头小松割灌机小松割灌机配件 咖啡厅员工制服_咖啡厅服务员制服_西餐咖啡服务员制服_咖啡馆制服_咖啡店西餐
  • 5号充电电池8节套装
  • 5-7号电池充电器
  • 充电电池5号正品
  • 可充电电池5号
  • 7号充电电池批发
  • 7号电池包邮
  • 1.5v充电电池5号
  • 5号充电器电池免邮
  • 双鹿电池5号正品
  • 双鹿9v电池
  • 双鹿电池批发
  • 双鹿7号电池
  • 双鹿1号电池
  • 双鹿碱性电池
  • 三星s4电池原装正品
  • 三星s4原装电池后盖
  • n7100原装电池
  • 小米2s原装电池
  • galaxy s4大容量电池
  • galaxy s4原装电池
  • galaxy s3电池
  • galaxy nexus电池
  • 三星galaxy s4电池后盖
  • 品胜小米2s电池
  • 品胜手机电池
  • 小米2a电池品胜
  • 背夹电池iphone4s
  • note2背夹电池
  • 三星s4背夹电池皮套
  • 自行车fixedgear 自行车眼镜 近视 婴儿推车小自行车 自行车骑行眼镜风镜 钻石自行车 山地自行车立管 led自行车气嘴专用灯 三鼎自行车坐椅儿童 自行车线管 金镶玉玉器挂件 自行车脚踏双轴承 铬钼钢架自行车 邦德自行车女式 山地公路自行车 自行车骑行手电筒 自行车灯架 灯夹包邮 自行车水壶支架 自行车 组装 mosso 自行车载mp3 26自行车 男生单车 自行车 折叠 复古 giant山地车 自行车 炫彩自行车 七彩马亲子自行车 ucc山地车 自行车 贝嘉琦 女孩自行车 zxc自行车配件码表 自行车前置安全椅 女童自行车 小龙哈比 自行车碳纤维垫圈 自行车骑行用品 装饰木板板材 美式壁挂装饰 家具装饰配件 衣服装饰亮片 婚礼礼品实用 公司开业庆典礼品 婴儿衣柜 儿童欧式公主床 床围栏护栏嵌入式 床靠背套 派克圆珠笔芯 卧室台灯床头灯现代 个性笔袋 派克im签字笔 彩色铅笔包邮 派克宝珠笔芯 派克笔芯正品 百乐摩可擦笔笔芯 斑马油笔 微型钢笔钓鱼竿 电子教鞭遥控笔 镭射灯激光笔 彩色水笔芯 黑色水笔笔芯 公爵宝珠笔芯 touch3代马克笔 韩国文具笔包邮 水溶性彩色铅笔 马可 sgp触控笔 礼品创意笔筒 铂金 项链 pt950 男 老竹笔筒 竹雕笔筒 六福珠宝铂金手镯 8.9寸笔记本电脑 三菱签字笔1.0 华硕游戏笔记本 插座面板

    Create a Slide Show Using the AJAX SlideShow and TreeView Controls

    Introduction

    Most web-based slide show applications depend on a database for some or all of the storage. This application allows you to show pictures from a directory structure without any underlying database. The application uses an ASP.NET 2.0 TreeView control for file system navigation and the AJAX 1.0 SlideShow Extender (control) to display the images found in the directory.

    Required Software

    In order to create this application, you need to install Microsoft Visual Studio. I used Visual Studio 2005 Professional. You also need to download the ASP.NET AJAX Extensions and the AJAX Control ToolKit found at http://www.asp.net. These are two different installs so make sure to get both. The version of AJAX you download must be compatible with your version of Visual Studio and .NET Framework. Since I'm using Microsoft Visual Studio 2005 and ASP.NET 2.0, I chose ASP.NET 2.0 AJAX Extensions 1.0. There is only one download for the Control Toolkit. If you are developing from an IIS website, as opposed to a Visual Studio project, make sure the web site is in the correct ASP.NET version. For my application, I choose 2.0.

    You may need to build the AJAX extensions or the AJAX Control ToolKit. You will need to remember the location of the build Control Toolkit's binary: AjaxControlToolkit.dll. You will add this library as a reference to your web project.

    A Quick Look at the Application

    The purpose of the application is, given a directory location, load and display any pictures in that directory via the SlideShow. The application is a single visual web page divided into two sections. The left side of the page is the navigation provided by the ASP.NET 2.0 TreeView control tied to the file system. The right side of the page is the Ajax SlideShow found in the Ajax Control Toolkit with some description labels and control buttons below the image.

    The application is based on four main files: Default.aspx, Default.aspx.cs, SlideService.asmx, and Web.Config. Default.aspx contains the graphical elements and their default values. Default.aspx.cs is the bulk of the work to control the navigation via the TreeControl, the ClickThrough, the ViewState and QueryString. SlideShow.asmx is the web service that the SlideShow Control relies on. Web.Config holds all locations and names for the application.

    Explanation of TreeView Structure Versus Web and File System

    The TreeView control displays and provides navigation for a hierarchical structure of data. This can be any hierarchy. Since the TreeView control is remarkable similar to the TreeView show in the file system application of the operating system, it is an obvious choice for navigation of any file system.

    The TreeView control in this article's application has several properties in each node to identify the node. The three most useful are the Text, ValuePath, and the Value. The Text is what displays in the tree, the directory name. For example, "Product Images". The Value is the web location of the location, for example, "/Images/Product/". The ValuePath is the location of the node as required by the TreeView control, for example "/Images/|/Images/Product/". The pipe character "|" is the PathSeparator. It is important to set the PathSeparator instead of taking the default which is "/". You can see where the ValuePath of "/Images///Images/Product/" would be easily confusing. When you use the ValuePath to find the node again, the TreeView control will not find the node using the default PathSeparator. In order to find the directory and it's child directories contained in the directory, the application uses Server.MapPath to change from the web location of "/Images/Product/" to "c:\project\Images\Product". This may seem simple but you need to be able to distinguish between these different address types while debugging.

    The SlideShow control, for this application, shows images in the location contained in the ContextKey and is the same value as the TreeView's Value property. If the location of the SlideShow images did not change, it would not be necessary to use the ContextKey.

    Control Location Example
    TreeView.SelectedNode.Text Product
    TreeView.SelectedNode.Value /Image/Product/
    TreeView.SelectedNode.ValuePath /Image/|/Image/Product/
    SlideShow.ContextKey /Image/Product/

    Introduction to SlideShow Web Service

    The SlideShow extender on the Default.aspx page relies on SlideService.asmx which returns an array of slides. This array contains the location, title, and description of the images to show in the slide show. The following XML is a returned Slide array:

    <?xml version="1.0" encoding="utf-8"?>
    <ArrayOfSlide xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://MYDOMAINHERE.com/">
        <Slide>
            <ImagePath>/images/images_15seconds.jpg</ImagePath>
            <Name> images_15seconds</Name>
            <Description />
        </Slide>
        <Slide>
            <ImagePath>/images/ images_Blue hills.jpg</ImagePath>
            <Name> images_Blue hills</Name>
            <Description />
        </Slide>
        <Slide>
            <ImagePath>/images/ images_Sunset.jpg</ImagePath>
            <Name> images_Sunset</Name>
            <Description />
        </Slide>
        <Slide>
            <ImagePath>/images/ images_Water lilies.jpg</ImagePath>
            <Name> images_Water lilies</Name>
            <Description />
        </Slide>
        <Slide>
            <ImagePath>/images/ images_Winter.jpg</ImagePath>
            <Name> images_Winter</Name>
            <Description />
        </Slide>
    </ArrayOfSlide>

    The <ImagePath> must be a valid value or the SlideShow will not display. The other tags of Name and Description can be empty.

    You will notice that all images supplied with the sample application have the directory name prefixed to the file name such as "images_Bull Hills.jpg" above. This is done on purpose for easy debugging. The images displayed should be prefixed by the TreeView.Value found in the selected node.

    Complexities of the Slide Service

    The only job your service needs to perform is, given a valid web directory, return a valid Slide array or NULL. In order to have a robust service, the service needs to:

    1. check that the web directory exists with Directory.Exists
    2. check that the image extensions are valid for this application by comparing the extension again a list in web.config
    3. return a valid image listed in web.config if no images are found in the directory

    Create Web Application

    In Visual Studio, create a new AJAX enabled web application.

    Add the AjaxControlToolkit.dll to the project as a reference.

    Create SlideService.asmx

    Add a web service file named SlideService.asmx. Change the supplied "Hello World" function to the following:

        [WebMethod]
        public AjaxControlToolkit.Slide[] GetSlides(String contextKey)
        {
            return null;
        }

    The function name is GetSlides. The parameter is contextKey of type String. You can use contextKey in anyway you want, it is meant to pass information from the calling AJAX control to the web service. In this application, the parameter will be used to supply the directory for the slide show to be fed from. The return parameter is an array of Slides. The AJAX SlideShow control looks for this signature and the signature is case sensitive and exact. Don't try to change any of this syntax or your service not be called.

    Add the following keys to Web.Config:

        <add key="SlideServiceNoImagesFoundLocation" value="NoImagesFound.jpg"/>
        <add key="SlideServiceValidImageExtensions" value="jpg,gif,bmp,ico"/>

    The first key provides a web location for an image to display in the slide show when no images are found in the directory specified in the contextKey parameter. In this case, the location is the root of the web site. The second parameter is a list of valid extensions in the directory to return in the slide array.

    In the above example, I have provided an image titled "NoImagesFound.jpg" which you will find in this articles' download package. The image is displayed as used in the application below:

    The function for NoImagesFound is below and is called from GetSlides():

        private AjaxControlToolkit.Slide[] GetNoImagesFoundDirectory()
        {
            AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[1];

            // get image from web.config and verify it exists on file system
            _noImagesFoundWebLocation = System.Configuration.ConfigurationSettings.AppSettings.Get("SlideServiceNoImagesFoundLocation");
            if (!File.Exists(Server.MapPath(_noImagesFoundWebLocation)))
                throw new Exception("SlideService.asmx::GetNoImagesFoundDirectory - NoImagesFoundLocation found in web.config does not exist after server.mappath - " + Server.MapPath(_noImagesFoundWebLocation));

            // create slide from image
            slides[0] = new AjaxControlToolkit.Slide(_noImagesFoundWebLocation, "No Images Found: Please click on another directory", "");

            // return slide
            return (slides);
        }

    This GetNoImagesFoundDirectory function creates a Slide array of one element. It grabs the image file location from Web.Config then verifies that the file does exist. It then adds the image into the Slide array with the title to indicate that the user should click on another directory.

    Two functions that are called from GetSlides() that are not provided in this article but are provided in the articles' download are IsImage() and GetImageExtensionsFromWebConfig().

    The function for GetSlides() is below:

        [WebMethod]
        public AjaxControlToolkit.Slide[] GetSlides(String contextKey)
        {
            // get valid extensions
            GetImageExtensionsFromWebConfig();

            // contextKey not empty
            if (String.IsNullOrEmpty(contextKey))
                return null;

            // contextKey in scope
            if ((contextKey.IndexOf("..")>=0))
                return null;

            // verify contextKey directory exists
            String mapPath = Server.MapPath(contextKey);
            if (!Directory.Exists(mapPath))
                throw new Exception("SlideService.asmx::GetSlides - mapPath does not exist - " + Server.MapPath(mapPath));

            // get files in contextKey directory
            string[] fileNames = System.IO.Directory.GetFiles(mapPath);
            if (fileNames.Length == 0)
                return GetNoImagesFoundDirectory();

            // create generic empty list of slides
            List<AjaxControlToolkit.Slide> list = new List<AjaxControlToolkit.Slide>();
            String justFileName;
            String displayedFileTitleOnSlider;
            String displayedFileDescriptionOnSlider;

            for (int i = 0; i < fileNames.Length; i++)
            {
                if(IsImage(Path.GetExtension(fileNames[i])))
                {
                    // get complete filename
                    justFileName = Path.GetFileName(fileNames[i]);

                    // get title
                    displayedFileTitleOnSlider = Path.GetFileNameWithoutExtension(fileNames[i]);

                    // set description to empty
                    displayedFileDescriptionOnSlider = String.Empty;

                    // add file to list of slides
                    list.Add(new AjaxControlToolkit.Slide(contextKey + justFileName, displayedFileTitleOnSlider, displayedFileDescriptionOnSlider));
                }
            }
            return (list.ToArray());
        }

    This GetSlides() function gets the valid file extensions from Web.Config and validates that contextKey is not empty and is not trying to go outside of the scope of this application for security. Then the application changes the contextKey from its web location to the physical location on disk via Server.MapPath and ensures its existence. Next the function grabs all files in the directory into a string array. If there are no filenames in the string array, the function returns the NoImagesFound image via the GetNoImagesFoundDirectory() function. Then the function creates an empty list of slides via generics. Then the files names are looped, looking for valid extensions. Each file name with a valid extension is added to the slide array. The file name minus the extension is the slide show image title. The slide show image description is empty.

    Add the following class variables:

        String _noImagesFoundWebLocation; //path and file of the image containing "No Images Found" text
        String _arrayOfImageExtensions; //string of valid image file extensions without "." in the value ex "jpg,gif"
        String[] _extensionList; //string array of valid image file extensions without "." and with comma removed

    Add the following references:

        using System.Web.UI.WebControls;
        using System.Diagnostics;
        using System.IO;
        using System.Configuration;
        using System.Collections.Generic;

    Add this to the declarations above the GetSlides function:

        [System.Web.Script.Services.ScriptService()]

    When you are done, test the service in the browser by calling the web service page directly: SlideService.asmx.


    (Full Size Image)

    Ensure that the results are in the following format:

        <Slide>
            <ImagePath>/images/Blue hills.jpg</ImagePath>
            <Name>Blue hills</Name>
            <Description />
        </Slide>

    A Word of Caution

    Do not move on to the web page until you are sure the slide service is returning the right data in the right format. When you build and test your web page, it will be nice to know that the slide service is not part of any bugs that pop up. The AJAX Slide Service control will not inform you when you are using it wrong or passing it malformed data from the slide service. It just won't work.

    Introduction to TreeView

    The TreeView control is a standard navigation control provided in System.Web.UI.WebControls namespace. The default start location of the TreeView control is stored in the TreeViewDefaultStartLocation key in the Web.Config. This location is the root of the control. All other nodes are added by crawling through the child directories in code.

    We need to add code to:

    1. given a selected node, pass the node's ValuePath as the contextKey to the web service
    2. given a location off the node passed in by query string, find the selected node and pass it's ValuePath as the contextKey to the web service

    The TreeView control has a concept of a selected node. Each node with children will have a selection icon such as a + sign. This indicates the node has children. Clicking on the plus sign is not "selecting" the node but just navigation through the nodes. Once you click on the name of the directory, you have selected it. The SlideShow will only change images on node selection, not on tree navigation.

    Introduction to the AJAX Slide Show

    The AJAX Slide Show control is a member of the AJAX control toolkit found in AJAXControlToolkit.dll. It displays images from a location found via a web path. The Slide Show control must know where to find the slide web service. This parameter is stored in the Web.Config in the SlideShowWebServiceLocation key and is a web path and file name. One of the parameters for the control is the location of the slide web service that the slide show uses. This is stored in the Web.Config file in the SlideShowDefaultLocation. Another parameter is the first file to load. This allows the slide show to display an image while the web service is building the array of slides. This value is stored in the Web.Config in the SlideShowDefaultLocationFirstPicture key.

    If you are using a single directory of images, you can set all the necessary values for the Slide Show in the control's parameters. You do not need to add any script/code. Since this application does change directories, some of the Slide Show parameters will be set in the code behind file.

    Modify Web Page

    In the default.aspx, add an AJAX Script Manager:

        <asp:ScriptManager ID="ScriptManager1" runat="server" />

    The script manager is provided from the AJAX Extensions library.

    Then add a TreeControl from the navigation tab of the toolbox. Change the default control from:

        <asp:TreeView ID="TreeView1" runat="server">
        </asp:TreeView>

    to:

        <asp:TreeView ID="TreeView1" runat="server"
            ExpandDepth=1
            ShowExpandCollapse=true
            OnSelectedNodeChanged="TreeView1_OnSelectedNodeChanged"
            PathSeparator="|"
            EnableViewState=true
            SelectedNodeStyle-Font-Bold=true
            SelectedNodeStyle-ForeColor=red
        />

    The two most important parameters are the OnSelectedNodeChanged and the PathSeparator. The OnSelectedNodeChanged will call the slide service for a new array of slides to display. The PathSeparator has already been discussed.

    Add an Image control which is where the Slide Show will display the images:

        <asp:Image ID="imgPhotos" runat="server" Height="300" Style="width:auto; border:solid 1px #000000;" />

    Add the SlideShow Extender (control) from the AJAX control toolkit. Change the default control from:

        <cc1:SlideShowExtender ID="SlideShowExtender1" runat="server">
        </cc1:SlideShowExtender>

    to:

        <cc1:SlideShowExtender ID="SlideShowExtender1" runat="server"
            TargetControlID="imgPhotos"
            SlideShowServiceMethod="GetSlides"
            SlideShowServicePath="/SlideService.asmx"
            ContextKey="images/"
            UseContextKey=true
            AutoPlay="true"
            NextButtonID="btnNext"
            PlayButtonText="Play"
            StopButtonText="Stop"
            PreviousButtonID="btnPrev"
            PlayButtonID="btnPlay"
            Loop="true"
            ImageTitleLabelID=lblTitle
            ImageDescriptionLabelID=lblDescription
        />

    The TargetControlId is where the slide show images will appear. You will also need buttons for Prev, Stop, and Next functionality as well as the Title and Description of the images. In this application, the title is used as the title of the file but the description is used to display the path of the file for debugging purposes. The LabelClickthroughURL is used to be able to test TreeView control navigation from a querystring. An example of this is to send a link to a non-root node via email.

    Add the following label controls below the Slide Show:

        <center><asp:Label ID="lblTitle" runat=server></asp:Label></center><br />
        <asp:Label ID="LabelTreeSelectedNode" runat=server></asp:Label><br />
        <asp:Label ID="LabelClickthroughURL" runat=server></asp:Label><br />
        <asp:Label ID="lblDescription" runat=server></asp:Label><br />
        <center>
        <asp:Button ID="btnPrev" Text="Prev" runat="server" />
        <asp:Button ID="btnPlay" Text="Play" runat="server" />
        <asp:Button ID="btnNext" Text="Next" runat="server" />
        </center>

    Default.aspx.cs

    The main work of the code behind file is to fill the TreeView control, find the correct node, and handle selection of the node.

    Add the following library to the default.aspx to handle file and directory management:

        using System.IO;

    The Page_Load function and the TreeView1_OnSelectedNodeChanged function are the two main functions in the default.aspx.cs. The rest of the functions will be lightly discussed here but are supplied in full in this article's download.

    The Page_Load function is below:

        protected void Page_Load(object sender, EventArgs e)
        {
            GetWebConfigSettings();
            VerifyDirectoriesAndFiles();

            // SET first image
            imgPhotos.ImageUrl = _slideShowDefaultLocation + _slideShowDefaultLocationFirstPicture;
            imgPhotos.AlternateText = _slideShowDefaultLocation + _slideShowDefaultLocationFirstPicture;

            // set web service path
            SlideShowExtender1.SlideShowServicePath = _slideShowWebServiceLocation;
            SlideShowExtender1.ContextKey = _slideShowDefaultLocation;

            // don't add copy of tree to tree on postback
            if (TreeView1.Nodes.Count == 0)
                PopulateTree();


            // Set From QueryString or ViewState
            if ((!String.IsNullOrEmpty(_currentTreePathQueryStringName)) && ((Request[_currentTreePathQueryStringName] != null) || (ViewState[_currentTreePathQueryStringName] != null)))
                SelectNodeBasedOnQueryStringOrViewState();
            // else assume first time to page
            else
            {
                // first time to page
                if (!String.IsNullOrEmpty(_slideShowDefaultLocation))
                {
                    ExpandTreePathByDirPath();
                }
            }

            // set labels so that selected info is visible on page
            //LabelTreeSelectedNode.Text = "<b>SlideShowExtender1.ContextKey:</b>" + SlideShowExtender1.ContextKey;
            if (String.IsNullOrEmpty(LabelClickthroughURL.Text))
            {
                LabelClickthroughURL.Text = "<a href='mailto:?subject=Picture SlideShow from the Berrys&amp;Body=" + HttpContext.Current.Request.Url + "?" + _currentTreePathQueryStringName + "=" + Server.UrlEncode(_slideShowDefaultLocation) + "'>Send link to this page by email</a><br>";
            }
        }

    The first two lines get directories and image information from the Web.Config, then verify their existence. The next two lines get the first image for the Slide Show. This is the image that is displayed while the Slide Show service is called and processed. It could be anything from a "please wait…" image to no image at all. The next line tells the Slide Show where to find the service it is to use to get the list of slides. The next couple of lines populate the TreeView control as long was the TreeView control isn't already populated. This is important for postback. The next section of lines determines which node in the TreeView control should be set as selected (and therefore highlighted in red) based on ViewState or QueryString. This is useful when you want to send the URL to someone and you want the TreeView to load from an interior node when they click on the link. The last line displays the current context key into a Label on the page for debugging purposes.

    The TreeView1_OnSelectedNodeChanged function is below:

        protected void TreeView1_OnSelectedNodeChanged(object sender, EventArgs e)
        {
            // DFB: Get Location of Node Selected used by TreeView to find a node
            _currentTreePath = TreeView1.SelectedNode.ValuePath;
            //lblDescription.Text = "<b>Selected ValuePath :</b>" + _currentTreePath ;

            // DFB: Get Location of web Directory
            SlideShowExtender1.ContextKey = TreeView1.SelectedNode.Value;
            //LabelTreeSelectedNode.Text = "<b>SlideShowExtender1.ContextKey:</b> " + SlideShowExtender1.ContextKey +
            // "<br><b>Server.MapPath(ContextKey)</b>:" + Server.MapPath(SlideShowExtender1.ContextKey);

            // DFB: If Path is not empty, add it to state so we have it on postback
            if (!String.IsNullOrEmpty(_currentTreePath))
            {
                ViewState.Add(_currentTreePath, _currentTreePath);

                LabelClickthroughURL.Text = "<a href='mailto:?subject=Picture SlideShow from the Berrys&Body=" + HttpContext.Current.Request.Url + "?" + _currentTreePathQueryStringName + "=" + Server.UrlEncode(_currentTreePath) + "'>Send link to this page by email</a><br>";
            }
        }

    This function is called when the name of a directory is clicked on, not when the expand/contract sign to the left of the name of the directory is clicked on. This selection of the directory name indicates that all valid images (as defined in Web.config) should be found (via the web service) and loaded into the Slide Show control or the "No Image Found" image should be loaded.

    The first two lines of the function grab the ValuePath and place it in a label on the page. The next couple of lines get the Value of the directory. This value is the new contextKey for the Slide Service and is placed in a label on the page. The next section of text adds the selected ValuePath to the ViewState and uses it to build a link that you could send someone to get back to this current node's display in the Slide Show.

    Once you have the default.aspx and default.aspx.cs written, make sure you have a working web service and valid values in the Web.Config.

    Summary

    Build your Slide service first and make sure it returns valid information. The function signature is exact, don't change the characters or case. Next build the default.aspx and the code behind page by adding a TreeView for navigation and the AJAX Slide Show for viewing.

    posted @ 2012-02-09 19:17  ChaunceyHao  阅读(348)  评论(0编辑  收藏  举报
  • 汽车羊毛坐垫长毛
  • 车垫四季通用
  • 御车宝
  • 凯美瑞坐垫四季通用
  • 手编冰丝坐垫
  • 珍珠戒指新款
  • 汽车皮坐垫四季垫
  • 汽车四季坐垫新款
  • 汽车皮坐垫四季通用
  • 汽车羊毛坐垫短毛
  • 包女
  • 汽车亚麻坐垫包邮
  • 汽车布坐垫
  • 汽车布坐垫套
  • 紫风铃亚麻四季坐垫
  • 蒙奇奇汽车
  • 蒙奇奇汽车毛绒坐垫
  • 蒙奇奇坐垫三件套
  • 尼罗河车坐垫
  • 尼罗河手编坐垫
  • 尼罗河四季垫
  • 羊剪绒坐垫
  • 牧宝冬季坐垫
  • 牧宝四季垫正品
  • 牧宝羽绒坐垫
  • 牧宝汽车垫羊毛
  • 高压洗车机
  • 高压洗车器
  • 高压洗车水泵
  • 高压洗车泵
  • 熊猫洗车
  • 洗车器高压220v
  • 洗车器便携高压
  • 高压水枪洗车机
  • 220v高压水枪洗车机
  • 家用洗车水枪高压枪
  • 汽车洗车水枪
  • 虎贝尔洗车水枪
  • 水枪头洗车
  • 洗车水枪水管
  • 洗车水枪套装
  • 洗车水枪接头
  • 佳百丽洗车水枪
  • 洗车工具套装
  • 洗车用品工具
  • 家用洗车工具
  • 汽车洗车工具
  • 洗车设备工具
  • 洗车刷子
  • 现代途胜保险杠
  • 现代新胜达保险杠
  • 保险杠车贴纸
  • 后保险杠车贴纸
  • 前保险杠车贴
  • 雨燕保险杠
  • 后保险杠贴纸
  • 前保险杠贴纸
  • 汽车保险贴纸
  • rav4后保险杠
  • 专业运动文胸htc c715e evo design 4g
  • htc evo 4g a9292
  • htc x515m g17 evo 3d
  • htc one x s720e
  • htc x920e
  • 名牌手表男正品
  • povos 奔腾 pffn3003苏泊尔电热水壶正品
  • tcl tcl电热水壶ta-kb181a
  • 乔邦181j
  • 乔邦不锈钢电热水壶
  • supor 苏泊尔 swf15j3-150
  • 逸动空气滤芯
  • 空气压缩机喷漆
  • 德国车载空气净化器
  • sr927w手表电池
  • cartier手表蓝气球
  • 机械手表男士名表
  • anne klein手表
  • 手表柜台展示柜
  • 女士皮带 头层牛皮
  • 女士皮带 头层纯牛皮
  • jeep皮带 纯牛皮
  • 女皮带 真皮 牛皮
  • 女士皮带 真皮
  • 头层牛皮皮带
  • 女士皮带 时尚
  • 真皮皮带头层牛皮女
  • 女士皮带 包邮
  • 皮带条 头层牛皮
  • 女士皮带 时尚 宽
  • 头层牛皮纯铜扣皮带
  • 女士皮带 纯牛皮
  • 女士皮带头层纯牛皮
  • 女士皮带头层牛皮
  • jeep皮带纯牛皮
  • 女皮带真皮牛皮
  • 女士皮带真皮
  • 女士牛皮皮带包邮
  • 女士皮带时尚
  • 三星微单镜头
  • 三星单反镜头
  • 三星50-200镜头
  • 三星7100镜头保护膜
  • 三星i9210
  • 三星i9210手机套面包蛋糕酸奶机
  • 鸡蛋牛奶面包干饼干
  • 面包片饼干
  • 摩托车机油