2 xieon1986 xieon1986 于 2013.10.14 19:02 提问

ajax AccordionPane后台添加后为什么客户端显示的样式是隐藏的

代码如下:
aspx页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



无标题页






cs页面:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.OracleClient;
using DataCommon;
using AjaxControlToolkit;

public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

        initAccordion();
        return;
    }
}
public void initAccordion()
{

    DataTable dtart = GetArtTypeable();
    BindAccordion(Accordion_Left, dtart);
    //DataTable dtdoc = GetDocTypeTable();
    //BindAccordion(Accordion_Left, dtdoc);


}

public void BindAccordion(Accordion AccordionID, DataTable dt)
{
    for (int i = 0; i < dt.Rows.Count; i++)
    {
        if (dt.Rows[i]["parentcode"].ToString() == "0")
        {
            AccordionPane ap = new AccordionPane();
            //ap.CssClass = "mina_left_content";
            ap.ID = "ApMenu_" + dt.Rows[i][0].ToString();
            Label lblMenu = new Label();
            lblMenu.ID = dt.Rows[i][0].ToString();
            lblMenu.Text = dt.Rows[i][1].ToString();
            lblMenu.CssClass = "mina_left_content";
            ap.HeaderContainer.Controls.Add(lblMenu);
            AccordionID.Panes.Add(ap);                  //创建知识类型根节点
        }
        else
        {
            AccordionPane ap = new AccordionPane();
            //ap.CssClass = "mina_left_content";
            ap.ID = "ApMenu_" + dt.Rows[i][0].ToString();
            HyperLink hlMenu = new HyperLink();
            hlMenu.ID = dt.Rows[i][0].ToString();
            hlMenu.Text = dt.Rows[i][1].ToString();
            //hlMenu.CssClass 
            ap.ContentContainer.Controls.Add(hlMenu);
            //hlMenu.NavigateUrl = dt.Rows[i]["ContentUrl"].ToString();
            AccordionID.Panes.Add(ap);                  //创建知识类型根节点
        }
    }
}

public DataTable GetArtTypeable()
{
    OracleConnection conn = new OracleConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["OracleConnectionString"].ConnectionString.ToString());
    string cmdText = "Select * from  ZS_ARTICLETYPE where isactive='1' order by PARENTCODE,orderid";
    OracleDataAdapter cmd = new OracleDataAdapter(cmdText, conn);//从数据库抓出数据
    DataSet ds = new DataSet();
    cmd.Fill(ds, "ZS_ARTICLETYPE");
    string sss = ds.Tables["ZS_ARTICLETYPE"].Rows.ToString();
    return ds.Tables["ZS_ARTICLETYPE"];
}

public DataTable GetDocTypeTable()
{
    OracleConnection conn = new OracleConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["OracleConnectionString"].ConnectionString.ToString());
    string cmdText = "Select * from  zs_documenttype where isactive='1' order by PARENTCODE,orderid";
    OracleDataAdapter cmd = new OracleDataAdapter(cmdText, conn);//从数据库抓出数据
    DataSet ds = new DataSet();
    cmd.Fill(ds, "zs_documenttype");
    string sss = ds.Tables["zs_documenttype"].Rows.ToString();
    return ds.Tables["zs_documenttype"];
}

}

输出结果
生成的Accordion菜单 子菜单项显示的div样式居然是style="display:none;"
求高手解答。。。。

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!