You have a form which has cascading list boxes as shown below. The first list bo
ID: 3816806 • Letter: Y
Question
You have a form which has cascading list boxes as shown below. The first list box is called Stock Owned (List1), which gets securitySymbol and securityName from the Security table. The second is called Dividends Received (List2), which gets dividendDate, and dividendAmount from the Dividend table (securitySymbol is also retrieved, but is not shown in the list box). At present, the list boxes are not linked together. List the Access steps required to link these two list boxes together, so that when the user selects a security in the first list box, the corresponding dividend information appears in the second list box.Explanation / Answer
You can use a kendo drop down list which will enhance you UI along with this it will have cascade property through which you can achievw this.
I have done something pity much similar. Please see this:
In the controller Please declare two IEnumerable list which gets data from the respective table. Take the value which you want to display in the list and set it as DataTextField. DataValueField Should be the Primary key of the tables. Cascade from will contain the foriegn key of the second table.
ViewBag.ProcessUnitList= (from str in objDBContext.masProcessUnits where str.IsActive == true select str).ToList();
ViewBag.ProcessAreaList=(from str in objDBContext.masProcessAreas where str.IsActive == true select str).ToList();
1st DropDownList Template
@using System.Collections
@(Html.Kendo().DropDownList()
.BindTo((IEnumerable)ViewBag.ProcessAreaList)
.HtmlAttributes(new { required = "required", data_required_msg = "The Process Area Name is required", @Style = "width: 140px;height:20px; font-size:12px;" })
.OptionLabel("- Select Area - ")
.DataValueField("ProcessAreaId")
.DataTextField("ProcessAreaName")
.Name("ProcessAreaId")
)
2nd DropDownList Template
@using System.Collections
@(Html.Kendo().DropDownList()
.BindTo((IEnumerable)ViewBag.ProcessUnitList)
.HtmlAttributes(new { required = "required", data_required_msg = "The Preocess Unit Name is required", @Style = "width: 180px;height:20px; font-size:12px;" })
.OptionLabel("- Select Unit - ")
.DataValueField("ProcessUnitId")
.DataTextField("UnitName")
.CascadeFrom("ProcessAreaId")
.Name("ProcessUnitId")
)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.