我使用一个数据绑定的下拉列表来填充一个包含项目迭代的组合框,并使用一个ascx控件来显示一个标记云。我正在检索下拉列表的selectedValue,并将其存储为一个会话,以过滤掉标记云(用于整个项目或通过迭代)。我收到一个错误,因为我输入的默认值无法转换为整数。提前感谢您的帮助!
filteroptions.Items.Insert(0, "Entire Project");
ASP.NET文件:
protected void filteroptions_SelectedIndexChanged(object sender, EventArgs e)
{
string selected_iteration = filteroptions.SelectedValue;
Session["iteration"] = selected_iteration;
}
ASCX控制:
protected void Page_Load(object sender, EventArgs e)
{
proj_name = Request.QueryString["project"].ToString();
proj_id = Request.QueryString["id"].ToString();
iteration = (string)Session["iteration"];
BindTagCloud();
}
private void BindTagCloud()
{
int pro_id = Convert.ToInt32(proj_id);
int iteration_id = Convert.ToInt32(iteration);
....
if (iteration_id != 0)
{
ListView1.DataSource = tagCloudNegativeIteration;
ListView1.DataBind();
ListView2.DataSource = tagCloudPositiveIteration;
ListView2.DataBind();
}
else
{
ListView1.DataSource = tagCloudNegative;
ListView1.DataBind();
ListView2.DataSource = tagCloudPositive;
ListView2.DataBind();
}
}