SlideShowExtender无法使用chrome

时间:2013-02-20 13:04:54

标签: c# ajax

幻灯片扩展程序在所有浏览器中的本地系统上工作正常,但是上传到服务器后,它无法在chrome中正确呈现。哪里可以在IE和Mozilla中正常工作。请帮忙。 以下是代码

  <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" CombineScripts="false"></asp:ToolkitScriptManager>
         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>


        <td width="10%" valign="top"> <asp:ImageButton ID="prevButton" runat="server"  ImageUrl="~/images/previous1.jpg" Height="13px" Width="12px" /></td>
        <td width="10%" valign="top"> <asp:ImageButton ID="playButton" runat="server" 
                ImageUrl="~/images/pause1.jpg" Height="13px" Width="10px"  /></td>
        <td valign="top" align="left" class="style9" >
        <asp:ImageButton ID="nextButton" runat="server" ImageUrl="~/images/next1.jpg" Height="13px" Width="12px" /></td>
        <td width="20%" valign="top"></td>
      </tr>
    </table>

     <table width="100%"  border="0" cellpadding="0" cellspacing="0" style="height:120px;">
          <tr>
            <td valign="top" align="left" colspan="2"> <asp:Image ID="Image1" ImageAlign="Left" ImageUrl="Admin/wowimg/Welcome to CADmylife-pic2x.jpg" runat="server" Height="117px" /></td>
            <td valign="top"><asp:Label ID="Label111" runat="server" Font-Names="Verdana" Font-Size="Small"></asp:Label>

     <asp:SlideShowExtender ID="SlideShowExtender1"  runat="server" 
      SlideShowServiceMethod="GetSlides" SlideShowServicePath="naresh.asmx"
      ImageDescriptionLabelID="Label111" 
      Loop="true" PlayInterval="5000"
       NextButtonID="nextButton"  PlayButtonText="Play"   StopButtonText="Stop"
       PreviousButtonID="prevButton"
        PlayButtonID="playButton" TargetControlID="Image1" Enabled="True" AutoPlay="true">      

              </asp:SlideShowExtender>

      </td>
          </tr>
        </table>
    </ContentTemplate>
            </asp:UpdatePanel> 

路径

  <%@ WebService Language="C#" CodeBehind="App_Code/naresh.cs" Class="naresh" %>

用于从数据库获取详细信息的C#代码

using System;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

/// <summary>
/// Summary description for naresh
/// </summary>

[WebService(Namespace = "http://tempuri.org")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 

[System.Web.Script.Services.ScriptService]
public class naresh : System.Web.Services.WebService {

    public naresh () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [System.Web.Services.WebMethod]
    [System.Web.Script.Services.ScriptMethod]

    public  AjaxControlToolkit.Slide[] GetSlides()
    {
        AjaxControlToolkit.Slide[] s = new AjaxControlToolkit.Slide[5];
        try
        {
            SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["conn"]);
            SqlCommand cmd = new SqlCommand("select top 5 substring([mesg],0,50)as [mesg],img,link,type from abcd where IsOnHme='Yes' order by slno desc", con);
            System.Data.DataSet ds = new System.Data.DataSet();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(ds);

            string k1 = "";
            if (ds.Tables[0].Rows[0]["type"].ToString() == "Wow")
            {
                if (ds.Tables[0].Rows[0]["link"].ToString() == "")
                {
                    k1 = "<font>" + ds.Tables[0].Rows[0][0].ToString() + "</font>";
                }
                else
                {
                  k1 = ds.Tables[0].Rows[0][0].ToString() + "...<a href=javascript:openwindow('" + ds.Tables[0].Rows[0]["link"].ToString() + "') class='smtxt'>More</a>";
                }
                s[0] = new AjaxControlToolkit.Slide("admin/wowimg/dot.jpg", "1", "<table><tr><td align='left'>" + k1 + "</td></tr></table>");
            }
            else if (ds.Tables[0].Rows[0]["type"].ToString() == "Ads")
            {
                if (ds.Tables[0].Rows[0]["link"].ToString() == "")
                {
                    k1 = " ";
                    s[0] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[0][1].ToString() + "", "1", "<table><tr><td align='left'>" + k1 + "</td></tr></table>");

                }
                else
                {
                    k1 = "<a href=javascript:openwindow('" + ds.Tables[0].Rows[0]["link"].ToString() + "') class='smtxt'><img src='admin/wowimg/" + ds.Tables[0].Rows[0][1].ToString() + "'></a>";

                    s[0] = new AjaxControlToolkit.Slide("admin/wowimg/dot.jpg", "1", "<table><tr><td align='left'>" + k1 + "</td></tr></table>");

                }

            //   s[0] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[0][1].ToString() + "", "a", "<table><tr><td align='left'>" + k1 + "</td></tr></table>");
            }
            else
            {
                k1 = ds.Tables[0].Rows[0][0].ToString() + "...<a href=javascript:openwindow('" + ds.Tables[0].Rows[0][2].ToString() + "') class='smtxt'>More</a>";
                s[0] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[0][1].ToString() + "", "1", "<table><tr><td align='left'>" + k1 + "</td></tr></table>");

            }
            string k2 = "";

            if (ds.Tables[0].Rows[1]["type"].ToString() == "Wow")
            {
                if (ds.Tables[0].Rows[1]["link"].ToString() == "")
                {
                    k2 = "<font>" + ds.Tables[0].Rows[1][0].ToString() + "</font>";
                }
                else
                {
                    k2 = ds.Tables[0].Rows[1][0].ToString() + "...<a href=javascript:openwindow('" + ds.Tables[0].Rows[1]["link"].ToString() + "') class='smtxt'>More</a>";
                }
                s[1] = new AjaxControlToolkit.Slide("admin/wowimg/dot.jpg", "2", "<table><tr><td align='left'>" + k2 + "</td></tr></table>");
            }
            else if (ds.Tables[0].Rows[1]["type"].ToString() == "Ads")
            {
                if (ds.Tables[0].Rows[1]["link"].ToString() == "")
                {
                    k2 = " ";
                    s[1] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[1][1].ToString() + "", "2", "<table><tr><td align='left'>" + k2 + "</td></tr></table>");
                }
                else
                {
                    k2 = "<a href=javascript:openwindow('" + ds.Tables[0].Rows[1]["link"].ToString() + "') class='smtxt'><img src='admin/wowimg/" + ds.Tables[0].Rows[1][1].ToString() + "'></a>";
                    s[1] = new AjaxControlToolkit.Slide("admin/wowimg/dot.jpg", "2", "<table><tr><td align='left'>" + k2 + "</td></tr></table>");

                }

            }
            else
            {
                k2 = ds.Tables[0].Rows[1][0].ToString() + "...<a href=javascript:openwindow('" + ds.Tables[0].Rows[1][2].ToString() + "') class='smtxt'>More</a>";
                s[1] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[1][1].ToString() + "", "2", "<table><tr><td align='left'>" + k2 + "</td></tr></table>");

            }



            string k3 = "";


            if (ds.Tables[0].Rows[2]["type"].ToString() == "Wow")
            {

                if (ds.Tables[0].Rows[2]["link"].ToString() == "")
                {
                    k3 = "<font >" + ds.Tables[0].Rows[2][0].ToString() + "</font>";
                }
                else
                {
                    k3 = ds.Tables[0].Rows[2][0].ToString() + "...<a href=javascript:openwindow('" + ds.Tables[0].Rows[2]["link"].ToString() + "') class='smtxt'>More</a>";

                }
                s[2] = new AjaxControlToolkit.Slide("admin/wowimg/dot.jpg", "3", "<table><tr><td align='left'>" + k3 + "</td></tr></table>");
            }
            else if (ds.Tables[0].Rows[2]["type"].ToString() == "Ads")
            {
                if (ds.Tables[0].Rows[2]["link"].ToString() == "")
                {
                    k3 = " ";
                    s[2] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[2][1].ToString() + "", "3", "<table><tr><td align='left'>" + k3 + "</td></tr></table>");
                }
                else
                {
                    k3 = "<a href=javascript:openwindow('" + ds.Tables[0].Rows[2]["link"].ToString() + "') class='smtxt'><img src='admin/wowimg/" + ds.Tables[0].Rows[2][1].ToString() + "'></a>";
                    s[2] = new AjaxControlToolkit.Slide("admin/wowimg/dot.jpg", "3", "<table><tr><td align='left'>" + k3 + "</td></tr></table>");

                }

            }
            else
            {
                k3 = ds.Tables[0].Rows[2][0].ToString() + "...<a href=javascript:openwindow('" + ds.Tables[0].Rows[2][2].ToString() + "') class='smtxt'>More</a>";
                s[2] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[2][1].ToString() + "", "3", "<table><tr><td align='left'>" + k3 + "</td></tr></table>");

            }


            string k4 = "";


            if (ds.Tables[0].Rows[3]["type"].ToString() == "Wow")
            {


                if (ds.Tables[0].Rows[3]["link"].ToString() == "")
                {
                    k4 = "<font >" + ds.Tables[0].Rows[3][0].ToString() + "</font>";
                }
                else
                {
                    k4 = ds.Tables[0].Rows[3][0].ToString() + "...<a href=javascript:openwindow('" + ds.Tables[0].Rows[3]["link"].ToString() + "') class='smtxt'>More</a>";
                }

                s[3] = new AjaxControlToolkit.Slide("admin/wowimg/dot.jpg", "4", "<table><tr><td align='left'>" + k4 + "</td></tr></table>");
            }
            else if (ds.Tables[0].Rows[3]["type"].ToString() == "Ads")
            {
                if (ds.Tables[0].Rows[3]["link"].ToString() == "")
                {
                    k4 = " ";
                    s[3] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[3][1].ToString() + "", "4", "<table><tr><td align='left'>" + k4 + "</td></tr></table>");

                }
                else
                {
                    k4 = "<a href=javascript:openwindow('" + ds.Tables[0].Rows[3]["link"].ToString() + "') class='smtxt'><img src='admin/wowimg/" + ds.Tables[0].Rows[3][1].ToString() + "'></a>";
                    s[3] = new AjaxControlToolkit.Slide("admin/wowimg/dot.jpg", "4", "<table><tr><td align='left'>" + k4 + "</td></tr></table>");

                }
                           }
            else
            {
                k4 = ds.Tables[0].Rows[3][0].ToString() + "...<a href=javascript:openwindow('" + ds.Tables[0].Rows[3][2].ToString() + "') class='smtxt'>More</a>";
                s[3] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[3][1].ToString() + "", "4", "<table><tr><td align='left'>" + k4 + "</td></tr></table>");

            }


            string k5 = "";

            if (ds.Tables[0].Rows[4]["type"].ToString() == "Wow")
            {


                if (ds.Tables[0].Rows[4]["link"].ToString() == "")
                {
                    k5 = "<font>" + ds.Tables[0].Rows[4][0].ToString() + "</font>";
                }
                else
                {
                    k5 = ds.Tables[0].Rows[4][0].ToString() + "...<a href=javascript:openwindow('" + ds.Tables[0].Rows[4]["link"].ToString() + "') class='smtxt'>More</a>";
                }

                s[4] = new AjaxControlToolkit.Slide("admin/wowimg/dot.jpg", "5", "<table><tr><td align='left'>" + k5 + "</td></tr></table>");
            }
            else if (ds.Tables[0].Rows[4]["type"].ToString() == "Ads")
            {
                if (ds.Tables[0].Rows[4]["link"].ToString() == "")
                {
                    k5 = " ";
                    s[4] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[4][1].ToString() + "", "5", "<table><tr><td align='left'>" + k5 + "</td></tr></table>");
                }
                else
                {
                    k5 = "<a href=javascript:openwindow('" + ds.Tables[0].Rows[4]["link"].ToString() + "') class='smtxt'><img src='admin/wowimg/" + ds.Tables[0].Rows[4][1].ToString() + "'></a>";
                    s[4] = new AjaxControlToolkit.Slide("admin/wowimg/dot.jpg", "5", "<table><tr><td align='left'>" + k5 + "</td></tr></table>");

                }

            }
            else
            {
                k5 = ds.Tables[0].Rows[4][0].ToString() + "...<a href=javascript:openwindow('" + ds.Tables[0].Rows[4][2].ToString() + "') class='smtxt'>More</a>";
                s[4] = new AjaxControlToolkit.Slide("admin/wowimg/" + ds.Tables[0].Rows[4][1].ToString() + "", "5", "<table><tr><td align='left'>" + k5 + "</td></tr></table>");

            }


            return s;
        }
        catch (Exception eex)
        {

            return s;
        }
    }

}

0 个答案:

没有答案