SlideshowExtender将图片作为链接...或建议另一种解决方案 [英] SlideshowExtender pictures as links...or suggest another solution

查看:54
本文介绍了SlideshowExtender将图片作为链接...或建议另一种解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS 2010和C#4.0,我想在幻灯片扩展程序中制作自动幻灯片图片。

Im using VS 2010 and C# 4.0 ans i want to make a auto slide pictures in slideshowextender.

了解我的问题这是我到目前为止的代码..

to understand my issue this is the code i have so far..

<script runat="Server" type="text/C#">
            [System.Web.Services.WebMethod]
            [System.Web.Script.Services.ScriptMethod]
            public static AjaxControlToolkit.Slide[] GetSlides1(string contextKey)
            {
                AjaxControlToolkit.Slide[] slides = null;
                
                int dbCount = Cars.GetCarsCount();
                List<int> ids = Cars.GetCarsIds();             
                slides = new AjaxControlToolkit.Slide[dbCount];               
                int i = 1;
                while (i < (dbCount + 1))
                {
                    slides[i - 1] = new AjaxControlToolkit.Slide("PhotoHandler.ashx?id=" + ids[i - 1], "<a href='" + "http://{...some url here}ValgtBil.aspx?id=" + ids[i - 1] + "'></a>", "< " + i + " of " + dbCount + " >");
                    i++;
                }
                return (slides);
            }
    </script>         




<asp:Image ID="Image1" runat="server" Height="169px" Width="184px" onclick="javascript:window.open(this.src)" Style="cursor:hand" BorderColor="Black" BorderStyle="Ridge" AlternateText="Loading please wait..."/>


<cc1:SlideShowExtender ID="SlideShowExtender1" BehaviorID="ss1" PlayInterval="6000"
              AutoPlay="true" 
               Loop="true"                                  
                 SlideShowServiceMethod="GetSlides1" ContextKey="0" 
                  TargetControlID="Image1" runat="server">
            </cc1:SlideShowExtender>   

所以现在发生的是,如果我点击图片它会打开我的处理程序,从db创建图片...但我想重定向到网站ValgtBil .aspx?id = {}而不是......这可能吗???

So what happens now is that if i click the picture it opens my handler where the picture is created from the db...But i want to be redirected to the site ValgtBil.aspx?id={} instead... Is this possible???

提前谢谢你......:)

Thank you in advance... :)

推荐答案

我能做到这一点,但这是一种黑客攻击

I could do this but it is a kind of a hack

onclick="javascript:window.location = ReturnImageUrl(this.src)" function ReturnImageUrl(splitUrl)             {                if (splitUrl)                 {                    var temp = splitUrl.toString();                    var temp2 = temp.split('?')[1];                    return "...ValgtBil.aspx?" + temp2;                } else                 {                    return null;                }            }




任何其他建议???


Any other suggestions???


这篇关于SlideshowExtender将图片作为链接...或建议另一种解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆