Populating dropdownlist based on other dropdwonlist in struts 2 - struts2

I have two drop-down lists that are populated from the DB. I want to populate the second drop-down dynamically based on the selected item in the first drop-down.
Can you help me? Thanks in advance.

Struts 2 has a double select tag that can do this:
http://struts.apache.org/2.1.6/docs/doubleselect.html

Related

Get dropdown list selected text and selected value while submiting in MVC?

How to get Drop down list with Selected Text and Selected Value while submitting the form in ASP.Net MVC
If there's any solution please let me know it.
If you are using Regex syntax for drop down list, then while posting the form the selected value will also be submitted to your action along with other details.

How to create filter for checkbox in kendo Grid MVC

I need to have a filter on my kendo grid for check box.
The checkbox is a Non-Bound column. Using checkbox I select the corresponding row.
I need to have a filter to get all the rows which are selected and not selected on the checkbox
columns.Template(#<text> </text>).ClientTemplate("<input type='checkbox' class='chkbx'").Title("Select");
Kindly help....
The best way to achieve such functionality is to extend your data source and add boolean column in your datasource definition. Then you will able to apply custom filter like this:
dataSource.filter({ field:"Field", operator: "eq", value: true });
As far I know - there is no build kendo way to manage filtering unbounded columns.

Dynamic display of labels using thymeleaf

I am using Thymeleaf and have a requirement of displaying labels dynamically based on database hit.
Suppose we have a column "Race" in our database and table name is "Table1" and the corresponding entity name is "Table1". When user access the html page (home.html) which will hit the table and return the values of field "Race". So if table has 2 values then 2 labels would get display on the page with the values on them and if there are 3 values then 3 labels respectively. I need a Thymeleaf or js code to implement this.
Please help and thanks in advance.
First of all you need proper controller:
#RequestMapping("/home")
public String showHome(Model model) {
List<Table1> list = //Invoke method to get proper rows from db for example use Spring CRUD Repository
model.addAttribute("list", list);
return "home"
}
Inside of your HTML put:
<label th:each="entity: ${list}" th:text="${entity.race}"></label>

Kendo-UI DropDownListFor - selected index

I need to change standard dropdown list to the one from kendo and and I've got a problem with getting appropriate selected value.
This code gives me a dropdown list with correct values, but doesn't give selected value (first one is selected).
#(Html.Kendo().DropDownListFor(m => m.CountryName)
.BindTo(Model.AllCountries)
.OptionLabel("-- Select country --")
)
Inside span (generated by kendo) with this dropdown I found input (type = text) with all values as options, and this input has correct value.
How to display this value in my kendo dropdown?
Thanks
Have you tried setting the name of the DropDownList equal to the name of the property in your model? The Kendo Documentation suggests that "if widget's name is different than the Model's property then the ModelBinder will not be able to update the model."

select all values of ASP.NET MVC2.0 ListBox when a checkbox is checked?

How to select all values of a ASP.NET MVC 2.0 ListBox when a checkBox is checked ?
See example here
http://www.qodo.co.uk/wp-content/uploads/2007/03/selectall.html
and explanation
http://www.qodo.co.uk/blog/javascript-select-all-options-for-a-select-box here
Just have to change the buttons to checkboxes
It's been done before although not via a checkbox but should be easily adaptable:
http://www.obout.com/mvc-listbox/apiclient/aspnet_apiclient_select_all.aspx

Resources