Click here to Skip to main content
15,888,251 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
C#
public ActionResult Pending_CashDisbursement()
        {           
            ViewData["listPA"] = GetPA();
            ViewData["listPSA"] = GetPSA();
            return View();
        }
        public SelectList GetPA()
        {
            cmn_top objCmn_top = new cmn_top();
            DataTable Dt_item = new DataTable();
            Dt_item = objCmn_top.Reports_GetPA_CD_Cash_();
            var collection = from dtRow in Dt_item.AsEnumerable() select new { Text = dtRow.Field<string>("ch_pacode"), Value = dtRow.Field<string>("ch_pacode") };
            var listPA = new SelectList(collection, "value", "text");
            return listPA;
            }
  
        public SelectList GetPSA()
        {
            cmn_top objCmn_top = new cmn_top();
            DataTable Dt_item = new DataTable();
            Dt_item = objCmn_top.Reports_GetPSA_CD_Cash_("L01");
            var collection = from dtRow in Dt_item.AsEnumerable() select new { Text = dtRow.Field<string>("PSATXT"), Value = dtRow.Field<string>("PSATXT") };
            var listPSA = new SelectList(collection, "value", "text");
            return listPSA;

        }

I have two lists(GetPA, GetPSA) now which will fill two dropdowns in the view page.
I want to fill the second list(GetPSA) with the selected value of the First List(GetPA).
How do i perform it? I am not able to do it , please help.
Posted
Updated 3-Oct-12 1:05am
v2

 
Share this answer
 
 
Share this answer
 
Another useful link you may find it useful and easy to understand for beginner. A working code is included in the post.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900