I need to create a new kendo widget. I searched for documentation but very less documentation is present. I am not clear with the steps needed to create new widget. Could anybody provide steps to create new kendo widget. I am very new to kendo.
I need to create html template and show it in kendo grid. The properties of html template should change according to the value in column for that particular row.
Related
What is the use of asp-for , asp-items in the dropdown used in the view page in C# and how to create a dropdown using it?
I am new to MVC architecture. I want to display MVC grid on my page but through databinding.
So currently in my controller I have created a list which I am returning to View.
Dim lst As New List(Of Employee)
.
.
Return View(lst)
In my View I have this code -->
#code
#Html.Grid(Model).Named("grdGrid").Sortable(True).Columns(Function(col) col.Add(Function(o) o.Id)).Columns(Function(col) col.Add(Function(o) o.EmpName))
End Code
So here I am able to display the grid correctly.
On similar basis, is it possible to databind the grid?
If I am getting my code in a data table, and that data table I want to directly bind to my MVC Grid. I do not want to use list.
Thanks
Amruta
Please refer to this blog post to render the pages with partial view.
Posting a link because there might be many pros & cons in your code but you'll get better idea from the link I posted.
I am working on a model criteria builder. I have a dropdown list with all of the model properties, a dropdown list with static operators (less than, equals, like, etc) and a user input form element for the value. The issue is that the form element type (dropdown, date, text box, etc) for the user input value needs to be based on the data type of the model property chosen in the first dropdown list. What is the best way to achieve this using MVC 2? Ideally I would like to just create an Html extension method and use it like Html.CriteriaFilterFor(model => model) and be able to customize the display using model attributes and metadata.
You should use JQuery to populate the other one. An AJAX call would allow you to pull the second drop down's list. Populating Dropdownlist Using MVC2 Based On Another Dropdownlist (Cascading DropDownList)
I am trying to write an MVC webpage that has two drop down lists. The content of the second list depends on what is selected in the first.
There does not seem to be a definitive way of doing this using built in MVC functions so I am going to have to roll my own. However I am not clear on the best way of getting all the functionality I require... which is "be the same as webforms" :)
I have created the dropdowns in a way similar to this
However I am not sure how to develop this so that if there is a 'selected' element in the first list when it is first bound this will flow through to automatically binding the second list on page load.
Edit:
Just to be clear I have the ability to bind the filtered list to the second dropdown. However if my Model contains a selection for the first dropdown the selection is set correctly but the second dropdown list does not fill.
(do I have to state I am newish to MVC and Javascript is like some alien language to me?)
Edit2:
I have thought about this a bit more.
Clearly I am strongly influenced by my time developing webforms and I don't quite 'get' MVC yet.
I think that really I have some things I should be catching in my model (ie if I already have the info to set the two dropdowns then I should in some way catch that in the controller and build the dropdowns pre set. Rather than trying to build an "ondatabound" type method and have the view call that (which was my initial intent)... Now I need to go and work out how to do that :)
This is one of the better implementations that I found. The question has also been discussed here.
You task contains 3 subtasks:
You should ajax get list of items for second ddl on changing selection of first ddl by using selected value
You should process action of getting list of items for 2-nd ddl by your Controller and return View with defined content of second ddl
You should update content of second ddl by getting result of processed action
<script type="text/javascript">
$(function(){
$("form #ddl_1").change(function(){
$.get({ // get request
url: "#Url.Action("MyController", "GetList"})" + "/" + $(this).val,
success: function(data){ // updating
$("form #ddl_2").html(data);
}
})
});
</script>
"GetList" action should take parameter "id" if you use default routes table (or you need to create special record at routes table with custom) and return partial view (without master page) with list of options for your ddl2, like this:
<option value="1">First</option>
<option selected value="2">Second</option>
<option value="3">Third</option>
See this blog post for creating cascading dropdown lists in asp.net mvc with downloadable source code.
I have a Telerik Grid, with two columns I need to keep second column as drop-down list box with in the grid, I am using ASP.NET MVC control
Can any body tell me how to do this?
I need to do that for my project.
Here is how I did it:
columns.Bound(o => o.Role).ClientTemplate(
Html.Telerik().DropDownList()
.Name("RoleList<#= UserID #>")
.BindTo(new SelectList(UserController.GetRoles()))
.ToHtmlString()
);
The static method GetRoles returns a simple IEnumerable of String. You still can return a custom object by using a different SelectList constructor to specify Value and Text property of your custom object.
new SelectList(UserController.GetCustomRoles(), "RoleID", "ShortName")
You can set the template of the column to embed arbitrary HTML. If using Ajax binding - try the client template. The following online examples will be helpful:
Server templates
Client templates