Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142964 | Feb 27,2019 06:11 AM UTC | Mar 21,2019 07:23 PM UTC | ASP.NET MVC | 15 |
![]() |
Tags: Checkbox |
var obj = { checkbox_1: true, checkbox_2: false, checkbox_3: true, checkbox_4: false, checkbox_5: true };
for (var key in obj) {
//looping the object for generating the checkbox based on the object length
var dynamicCheckBoxes = document.createElement("input");
dynamicCheckBoxes.setAttribute("type", "checkbox");
dynamicCheckBoxes.setAttribute("id", [key]);
document.body.appendChild(dynamicCheckBoxes);
var breakEle = document.createElement("br");
document.body.appendChild(breakEle);
$("#" + [key]).ejCheckBox({ checked: obj[key], text: [key] });
}
|
@Html.EJ().CheckBox("check1").Value("Music").Checked(false).Text("Check to enable below controls").ClientSideEvents(obj => obj.Change("checkstateChange"))
@Html.EJ().DropDownList("customerList").Datasource(ds => ds.URL("//js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/").CrossDomain(true)).Query("ej.Query().from('Customers').take(6)").DropDownListFields(f => f.Text("CustomerID")).ShowCheckbox(true).WatermarkText("Select a customer").Enabled(false)
@Html.TextBox("myTextBox", "This is value", new { @class = "form-control", disabled = "disabled" })
<br>
@Html.EJ().Button("add").Text("Add").ShowRoundedCorner(true).Size(ButtonSize.Medium).Enabled(false).ClientSideEvents(obj => obj.Click("addNewControls"))
@Html.EJ().Button("submit").Text("Submit").ShowRoundedCorner(true).Size(ButtonSize.Medium).Enabled(false)
<script>
$(document).ready(function () {
checkFunction();
});
function checkFunction() {
var obj = $("#customerList").ejDropDownList("instance");
if (obj.model.enabled) {
obj.checkAll();
obj.disableItemsByIndices("0,3,5");
}
}
function checkstateChange(args) {
if (args.isChecked) {
var dropDownListObj = $("#customerList").ejDropDownList("instance");
dropDownListObj.option("enabled", true);
var addButtonObj = $("#add").ejButton("instance");
addButtonObj.option("enabled", true);
$("#myTextBox").removeAttr("disabled");
var submitButtonObj = $("#submit").ejButton("instance");
submitButtonObj.option("enabled", true);
checkFunction();
}
}
function addNewControls() {
$('<select>', { id: "dropDown" + "_" + $.guid }).insertBefore('#add');
$("<br>").insertBefore('#add');
$('<input>', { id: "inputValue" + "_" + $.guid, class: "form-control" }).insertBefore('#add');
$("<br>").insertBefore('#add');
var dataManger = ej.DataManager({
});
// Query creation
var query = ej.Query().from("Customers").take(6);
$('#' + "dropDown" + "_" + $.guid).ejDropDownList({ dataSource: dataManger,fields: { text: "CustomerID" },
query: query, showCheckbox: true,
actionComplete: function (args) {
//Fires the action when the list of items is bound to the DropDownList by xhr post calling.
$('#' + "dropDown" + "_" + $.guid).ejDropDownList("selectItemsByIndices", "2,3,5");
}
});
}
</script> |
@Html.EJ().ListView("checklist").ShowHeader(false).EnableCheckMark(true).Items(items =>
{
items.Add().Text("Artwork");
items.Add().Text("Abstract");
items.Add().Text("2 Acrylic Mediums");
items.Add().Text("Creative Acrylic");
items.Add().Text("Modern Painting");
items.Add().Text("Canvas Art");
items.Add().Text("Black white");
items.Add().Text("Children");
}).ClientSideEvents(evt => evt.Create("onCompleteLoad"))
<script>
function onCompleteLoad() {
var obj = $("#checklist").ejListView("instance");
//disable items
obj.disableItem(2);
obj.disableItem(5);
//select all items
obj.checkAllItem();
};
</script> |
@Html.EJ().CheckBox("check1").Value("Music").Checked(false).Text("Check to enable below controls").ClientSideEvents(obj => obj.Change("checkstateChange"))
<div class="divcontainer">
@Html.EJ().DropDownList("customerList").Datasource(ds => ds.URL("//js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/").CrossDomain(true)).Query("ej.Query().from('Customers').take(6)").DropDownListFields(f => f.Text("CustomerID")).ShowCheckbox(true).WatermarkText("Select a customer").Enabled(false)
@Html.TextBox("myTextBox", "This is value", new { @class = "form-control", disabled = "disabled", width = "100px", height = "30px" })
</div>
@Html.EJ().Button("add").Text("Add").ShowRoundedCorner(true).Size(ButtonSize.Medium).Enabled(false).ClientSideEvents(obj => obj.Click("addNewControls"))
@Html.EJ().Button("submit").Text("Submit").ShowRoundedCorner(true).Size(ButtonSize.Medium).Enabled(false)
<script>
$(document).ready(function () {
checkFunction();
});
function checkFunction() {
var obj = $("#customerList").ejDropDownList("instance");
if (obj.model.enabled) {
obj.checkAll();
obj.disableItemsByIndices("0,3,5");
}
}
function checkstateChange(args) {
if (args.isChecked) {
var dropDownListObj = $("#customerList").ejDropDownList("instance");
dropDownListObj.option("enabled", true);
var addButtonObj = $("#add").ejButton("instance");
addButtonObj.option("enabled", true);
$("#myTextBox").removeAttr("disabled");
var submitButtonObj = $("#submit").ejButton("instance");
submitButtonObj.option("enabled", true);
var deleteButtonObj = $("#delete").ejButton("instance");
deleteButtonObj.option("enabled", true);
checkFunction();
}
}
function addNewControls() {
$('<div>', { id: "div" + "_" + $.guid, class: 'divclass' }).insertBefore('#add');
$('<select>', { id: "dropDown" + "_" + $.guid }).appendTo('#' + "div" + "_" + $.guid);
$('<input>', { id: "inputValue" + "_" + $.guid, class: "form-control" }).appendTo('#' + "div" + "_" + $.guid);
var dataManger = ej.DataManager({
url: "https://mvc.syncfusion.com/Services/Northwnd.svc/"
});
// Query creation
var query = ej.Query().from("Customers").take(6);
$('#' + "dropDown" + "_" + $.guid).ejDropDownList({
dataSource: dataManger, fields: { text: "CustomerID" },
query: query, showCheckbox: true,
actionComplete: function (args) {
//Fires the action when the list of items is bound to the DropDownList by xhr post calling.
$('#' + "dropDown" + "_" + $.guid).ejDropDownList("selectItemsByIndices", "2,3,5");
}
});
}
</script>
<style>
.form-control {
display: inline-block;
margin-left: 30px;
}
.divcontainer {
display: flex;
margin: 30px;
}
</style> |
$('#bikeList').ejDropDownList({
dataSource: BikeList,
fields: { id: "empid", text: "text", value: "text" },
create:"onCreate"
});
function onCreate() {
ddlObj= $('#bikeList').data("ejDropDownList");
ddlObj.container.ejTooltip({
content: "ejDropDownList"
});
}
|
function onCreate() {
ddlObj= $('#bikeList').data("ejDropDownList");
ddlObj.container.ejTooltip({
content: ddlObj.model.value,
open: "onOpen"
});
}
function onOpen () {
tipObj= $('#bikeList_container').data("ejTooltip"); // "bikeList_container" is the id attribute for dropdownlist's container
tipObj.setModel({ content: ddlObj.model.value});
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.