楼主用的是别人写好的控件吧,看到你里面有两级菜单。如果没有属性设置的话,就要改这个控件的源代码。有源代码吗?
后台源码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Reflection;
using System.Drawing;
using JH.Game.ServiceLibrary.Model;
using JH.Game.ServiceLibrary.Bll;
using System.Data;
public partial class Manage_Examination_Default2 : System.Web.UI.Page
{
#region Protected method
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
populateDdlMultiColor();
}
}
protected void ddlMultiColor_OnSelectedIndexChanged(object sender, EventArgs e)
{
}
#endregion
#region private method
private List<string> finalColorList()
{
string[] allColors = Enum.GetNames(typeof(System.Drawing.KnownColor));
string[] systemEnvironmentColors = new string[(typeof(System.Drawing.SystemColors)).GetProperties().Length];
List<string> finalColorList = new List<string>();
foreach (string color in allColors)
{
if (Array.IndexOf(systemEnvironmentColors, color) < 0)
{
finalColorList.Add(color);
}
}
return finalColorList;
}
private void populateDdlMultiColor()
{
ddlMultiColor.DataSource = finalColorList();
ddlMultiColor.DataBind();
}
#endregion
}
前台
:
<asp:DropDownList ID="ddlMultiColor" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddlMultiColor_OnSelectedIndexChanged">
</asp:DropDownList>
这个是什么也没设置,好像就是绑定数据的问题,我以绑定自己的数据,滚动条就没了!不知道是不是我的数据长度不够长
我实在不知道怎么改
这是我的数据:
public void Bind()
{
DeptBll dpbll = new DeptBll();
DataSet ds = dpbll.GetDs();
this.DropDownList1.DataSource = ds;
DropDownList1.Items.Insert(0, new ListItem("--请选择--", " "));
DataTable dt = ds.Tables[0];
//绑定数据到栏目列表上
bindtodroplist(dt, 0);
}
/// <summary>
/// 页面加载绑定数据源
/// </summary>
public void bindtodroplist(DataTable dt, int parentid)
{
DataView dv = new DataView(dt);
dv.RowFilter = " ageid= " + parentid.ToString(); //过滤
int layer = 0; //默认为第一层
foreach (DataRowView drv in dv)
{
layer = int.Parse(drv["deptnamejm"].ToString().Trim()); //取得第几层
string span = "";
if (drv["ageid"].ToString() != "0")
{
for (int i = 0; i < layer; i++)
{
span += " ";
}
span += "╴";//添加前面的空格
}
ListItem li = new ListItem();
li.Text = span + drv["deptname"].ToString();
li.Value = drv["deptid"].ToString();
this.DropDownList1.Items.Add(li);
bindtodroplist(dt, Convert.ToInt32(drv["deptid"]));
}
}
要是能给改过来就感谢你八辈祖宗