从asp.net中的多个Listbox中选择多个列表项

时间:2012-12-06 09:04:52

标签: asp.net

我的asp页面中有动态列表框。我需要从下面的前面的每个列表框中选择项目。选定的项目

[Date].[Calendar Date].[Calendar Year].&[2002] from one list box

[Date].[Calendar Date].[Calendar Semester].&[2002]&[2] from another list box

[Date].[Calendar Date].[Calendar Quarter].&[2001]&[4] from another etc....

我需要将以上所选项目带到下面

FROM ( SELECT { 
[Date].[Calendar Date].[Calendar Year].&[2002]
} ON COLUMNS 
FROM ( SELECT { 
[Date].[Calendar Date].[Calendar Semester].&[2002]&[2]
} ON COLUMNS 
FROM ( SELECT { 
[Date].[Calendar Date].[Calendar Quarter].&[2001]&[4]
} ON COLUMNS

以下代码我曾经这样做但没有运气:)

    protected void imgRunReport_Click(object sender, ImageClickEventArgs e)
{
Panel tt = Cache["tt"] as Panel;
string mdxqry;
isRefresh = true;
string Cubename = ddlCubeList.SelectedItem.Value;


Dictionary<string, string> selectedfil = new Dictionary<string, string>();
foreach (ListBox ctl in tt.Controls.OfType<ListBox>())
{
string strSelectedFilters = string.Empty;
selectedfil.Remove(ctl.Text);

foreach (ListItem li in ctl.Items)
{

if (li.Selected)
selectedfil.Add(li.Text, li.Value);

}
strSelectedFilters = "FROM ( SELECT { " + string.Join("," , new List<string>(selectedfil.Values).ToArray()) + "}" + " ON COLUMNS ";



}

}

Remember: these values comes from dynamic listboxes

提前谢谢

0 个答案:

没有答案