我有Repeater绑定方法此方法通过存储过程从数据库中检索数据,当Model_Id传递给此方法时,它将检索数据,当用户多次选择DDL时,用户可以多次重复中继器。我做的代码,我添加哪些用户从DDL在数组列表,但错误选择所有Model_Ids出现无法将数组列表转换为字符串
不能数组列表转换为字符串值:
protected void Add_Click(object sender, ImageClickEventArgs e)
{
ArrayList Array = new ArrayList();
Array.Add(DDLModel.SelectedValue);
DLHome.DataSource = Cls.GetModelName(Array);
DLHome.DataBind();
}
public DataTable GetModelName(string Model_Id)
{
using (SqlConnection conn = Connection.GetConnection())
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "GetComparisonModel";
SqlParameter ParentID_Param = cmd.Parameters.Add("@Model_Id", SqlDbType.Int);
ParentID_Param.Value = Model_Id;
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(dt);
return dt;
}
}