jquery ui中 accordion的问题及我的解决方法

jquery有一套所谓的ui组件,很不错的。如果有兴趣的朋友,可以参考http://jqueryui.com/

但其中的accordion,我使用的时候发现一些问题。如果按照demo那样,写一些静态内容,倒也正常。但如果每个面板里面的内容是动态绑定的,则会发生高度变小,然后出现滚动条的诡异现象

 

<%@ Page Language="C#" %>

<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Xml.Linq" %>

<script runat="server">
    protected override void OnPreInit(EventArgs e)
    {
        rp.ItemDataBound += new RepeaterItemEventHandler(rp_ItemDataBound);
    }

    void rp_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Label lb = e.Item.FindControl("categoryId") as Label;
        if (lb != null)
        {
            string id = lb.Text;
            var forms = from x in config.Root.Descendants("Form")
                        where x.Attribute("CategoryId").Value == id
                        select new
                        {
                            FormTitle = x.Attribute("Title").Value,
                            FormDescription = x.Attribute("Description").Value,
                            Url = x.Attribute("Url").Value,
                            Icon = "Forms/Icons/" + x.Attribute("Icon").Value
                        };

            Repeater temp = e.Item.FindControl("rp_forms") as Repeater;
            temp.DataSource = forms;
            temp.DataBind();

        }
    }

    protected override void OnLoad(EventArgs e)
    {
        if (!IsPostBack)
            DataBind();

    }

    private XDocument config = null;

    public override void DataBind()
    {
        //先读取分类数据
        config = XDocument.Load(Server.MapPath("Forms/Forms.xml"));
        var categories = from x in config.Root.Descendants("Category")
                         orderby x.Attribute("Id").Value
                         select new
                         {
                             Title = x.Attribute("Title").Value,
                             Id = x.Attribute("Id").Value,
                             Description = x.Attribute("Description").Value
                         };
        rp.DataSource = categories;
        rp.DataBind();


    }
    
    
    

   script>


"server">

    

    

    

    
  "themes/cupertino/ui.all.css" rel="stylesheet" type="text/css" />

    
    

  

   
  

    

  


  




  

 

        
  
  
  
  
0
0
 
 

你可能感兴趣的:(jquery,UI,server,asp,div,Forms)