I have multiple dropdownlist, i want to bind the data on page load, I'm working on MVC 4. In single stored procedure, i'm selecting data from different table. Each select for one dropdownlist. here i assigning value to list, i want to return everything in a single list to controller. herewith i have given single dropdown as a sample.
public class SampleClass1
{
public string ID { get; set; }
public string Cr_PId { get; set; }
public string Cr_cId { get; set; }
public string Res { get; set; }
public string Descr { get; set; }
public IList<ApplicationMaster> lstappmas { get; set; }
}
public class ApplicationMaster
{
public string ApplicationId { get; set; }
public string ApplicationName { get; set; }
}
public List<CrimsDetailModel> GetCrimsDetails()
{
List<CrimsDetailModel> lstcrimsdtls = new List<CrimsDetailModel>();
List<ApplicationMaster> lstappdtls = new List<ApplicationMaster>();
DataSet dscrmodel = new DataSet();
Hashtable htcrmodel = new Hashtable();
dscrmodel = DataProxy.FetchDataSet("GetCrimDetails");
dscrmodel.Tables[0].TableName = "CRdetails";
dscrmodel.Tables[1].TableName = "ApplicatonMaster";
try
{
foreach (DataRow dr in dscrmodel.Tables["CRdetails"].Rows)
{
CrimsDetailModel objcrmodel = new CrimsDetailModel();
objcrmodel.ID = dr["CR_PaId"].ToString();
objcrmodel.Cr_PId = dr["CR_PId"].ToString();
objcrmodel.Cr_cId = dr["CRIMS_CId"].ToString();
objcrmodel.Res = dr["Res"].ToString();
objcrmodel.Desc = dr["Desc"].ToString();
lstcrimsdtls.Add(objcrmodel);
}
foreach (DataRow dr in dscrmodel.Tables["Appdetails"].Rows)
{
ApplicationMaster objapp = new ApplicationMaster();
objapp.ApplicationId = dr["ApplicationId"].ToString();
objapp.ApplicationName = dr["ApplicationName"].ToString();
lstappdtls.Add(objapp);
}
return lstcrimsdtls;
}
When i assign