Create a Web Grid using Javascript - asp.net-mvc-3

Can we create a WEB GRID dynamically using JAVASCRIPT ?
I am using MVC 3 and Razor as my view.
On one of my Razor view I have a drop down box what I want is to create a web grid dynamically on selection of a drop down I get the data depending on the value selected from the drop down box.
Please help me on this.

I had to use ajax for this, where I had called a method using ajax and my method (present in the controller) returned a partial view.
My partial view had the grid I needed to show. and in the method (present in the controller) I had passed value from the dropdown box using ajax, and using this value I had queried my database and sent that model to the partial view.

Related

How to read datasource of a Kendo DropDownList only once?

(MVC Razor) So on my page I have a Kendo grid which contains a DropDownList within a certain column. Now I don't want to fill data of my dropdownlist from controller (With Viewbag/ViewData) before the page loads because it would slow it down, but instead I'd like to fill the DropDownList data on user click with a call to a controller function, and call the read method only once(on first click). How would I be able to achieve this goal?
Set autoBind property to false. It will cause that dropdown will not be filled by data before user click on it.
After component is initialized dataBound event is started so you can set readonly in it.
Demo here

Telerik MVC grid data binding using Stored Procedure

Am using a telerik mvc grid to populate a data by passing the text that the user enters in a HTML textbox. Once the text is entered, I have a button which once we click, it should populate a telerik mvc grid with data (data should come by passing in the text into the stored procedure).
I have the stored proc, I have the controls in place and I want to use ajax binding to get the data from the controller using a view model. Am new to Razor, please help.
Check this demo, I think it is really close to the case you explained.
http://demos.telerik.com/aspnet-mvc/Grid/Filtering?theme=vista

Hide the Partial view and show another partial view in mvc3

I have a hyperlink column in the grid. On clicking the link i have to hide the partialview(grid section) and have to show/load another partialview which is the detail section. Please provide solution
You could use javascript. With jQuery that will correspond to the .toggle() function or the .show()/.hide() functions. So basically you will subscribe to the click event of the link and inside this handler show and hide the respective sections. For this to work you should obviously place those partials inside placeholder divs so that you could show/hide the entire placeholder.
If in addition to showing the partial you need to fetch some fresh information from the server then you could use AJAX to request a controller action that will return the fresh data of the partial view that you will inject into the DOM at the correct placeholder location. In order to send an AJAX request in jQuery you could use the $.ajax() function or directly the .load() function.

MVC3 Is It Possible to Create Model from Parent Model in Single View/Controller?

So my MVC ignorance is showing more and more each day. I have a view that is bound to a Model of [Category] which has simply a table of categories and a link that allows you to add a [Item] to that category and am attempting to display that partial view ([InsertCategoryItem]) inside a Telerik.Window object and do an HttpPost or Ajax Post to submit the view model to the controller and have it add the [Item] to the database. Is this possible? If so, can anyone give me a stripped-down example of what the View and controller should look like?
Oh, and my project is MVC3, SqlServerCompactEdition (4.0), Telerik Extensions, Razor views
You can achieve it by using custom toolbar template and grid Editing. By combining these two features you can achieve you required. If you want custom popup then you have to use custom editor template of the type of your model

render partial view from a grid selection in mvc3

I have a telerik grid in an MVC 3 Razor project. Next to the grid is a partial view that uses an appropriate model template. How would I go about using the onRowSelect to render the partial view with the index from the row selected. Essentially its calling a javascript, in the java script it specifies the index int I want to pass to the partial view. However, I am unable to render the partial view with the new index.
Any thoughts?
Have you triclient selection in telerik demo page
I ended up using the ajax update targetID

Resources