Telerik Forums
UI for ASP.NET MVC Forum
5 answers
387 views
Hi
i am using telerik for one of my project where i use custom button placed ouside grid for saving the whole grid data. (c#.net)
Now i am working on MVC Razor i see in kendo with toolbar,
can we have the same tool bar functionality outside grid meaning ,
can i use one button (save) where i can take all grid datas and do the same process how toolbar does(iterate)
and save .

I know batch process does individual grid save , i need to send some 4 grid to controller and save

I have one requirement of this type

Please let me know whether above requirement possible or not

Senthil

Dimiter Madjarov
Telerik team
 answered on 16 May 2013
1 answer
146 views
Hello,

I am trying to implement the edit, delete and save functionality in the grid. I am facing couple of issues during the development.
I have to use the drop down list to display the multiple values in one of the column. I have read few posts in this forum and I checked with examples which has been downloaded from this site. Still, I could not make it work.
While editing, I have to display the datepicker in the date of birth column, how can I add the datepicker control inside the grid.
The same way I need to give more flexibility to the use to increase / decrease the number values. When I edit the record, always I get the textbox for all the columns.

I have attached my project. Please go through and let me know what I am missing to make it work successfully.

Thanks!
Vladimir Iliev
Telerik team
 answered on 16 May 2013
1 answer
292 views
I have a grid with two columns: OrganizationId and OrganizationName. 

The users are able to create/edit new Organizations. when an user clicks in the Create toolbar button both properties should be editable. 
The thing is, when the grid is rendered it probably has some records, so if the user tries to edit one of those, he/she is going to be able to edit the OrganizationName, but the OrganizationId has be a label. 
This last behavior doesn't apply if the user tries to edit a new record (a record added with the create button functionality in this render time).
 
At the end it should be like
if it's old record -> edit mode = label + textbox
if it's new record -> create/edit mode = textbbox + textbox

Right now I have my custom kendo wrapper that reads the object properties, dynamically builds the grid columns and returns a GridBuilder. It look like this: 
01.public static CustomGridFor<TProperty> KendoGrid<TModel, TProperty>(
02.    Expression<Func<TModel, IEnumerable<TProperty>>> expression,
03.    string defaultProperty,
04.    string createAction,
05.    string readAction,
06.    string updateAction,
07.    string controller,
08.    string errorHandler) where TProperty : class
09.{
10.    var dataSource = expression.Compile().Invoke(htmlHelper.ViewData.Model);
11.    var gridColumnSettings = GridBuilderExtensions.CreateGridColumnSettings<TProperty>() as List<GridColumnSettings>;
12.    if (gridColumnSettings != null)
13.    {
14.        gridColumnSettings.Add(new GridCommandColumnSettings { Commands = { new GridEditActionCommand(), }, });
15.    }
16. 
17.    var gridBuilder = new this.Grid(dataSource)
18.        .Name("GridName")
19.        .Columns(c => c.LoadSettings(gridColumnSettings))
20.        .DataSource(source => source
21.            .Ajax()            
22.            .PageSize(50)
23.            .Model(model => model.Id(defaultProperty))
24.            .Destroy(d => d.Action(destroyAction, controller))
25.            .Read(r => r.Action(readAction, controller))
26.            .Update(u => u.Action(updateAction, controller))
27.            .Batch(true)
28.            .Events(e => e.Error(errorHandler)))
29.        .ToolBar(a => a.Create().Text("New"))
30.        .Editable(editable => editable.Mode(GridEditMode.InLine));
31.         
32.    return gridBuilder;
33.}

I made some research about the grid behavior and found the  Grid / Editing custom editor, this example has a ClientTemplate and Editable as false, something like this is what I want for the OrganizationId edit mode in the in old records and for the new ones edition I can use the Inline Editing.
01....
02.columns.Bound(p => p.Category).ClientTemplate("#=Category.CategoryName#").Width(160);
03....
04..Model(model =>
05.{
06.    model.Id(p => p.ProductID);
07.    model.Field(p => p.ProductID).Editable(false);
08.})
09....


Another question that I have,  is there any way to set the DataSource Model property dynamically?
1....
2..DataSource(source => source.Ajax()
3.    .Model(model =>
4.    {
5.        model.Id(p => p.ProductID);
6.        model.Field(p => p.ProductID).Editable(false);
7.    })
8....

I mean, do something like the columns loading where we can build the columns list with its name, behavior, ... and then set it.
1..Columns(c => c.LoadSettings(new IEnumerable<GridColumnSettings>()))


thanks in advance,
-julio
Vladimir Iliev
Telerik team
 answered on 16 May 2013
6 answers
379 views

Hi,

I’m working with a Kendo Grid using MVC4 with Razor’s syntax.

I need to be able to customize column’s order and displaying option in order to save user’s preference.

To achieve that, I tried to use a tab of GridColumnSettings and load it in the View using the LoadSettings method of the columns property.

I have a few issues with that:

-          Even if the column order can be set dynamically with this method, I don’t understand how to use ClientTemplate or Template attribute of the GridColumnSettings object.

-          By using this loading system I have two Gird's options who don’t work anymore: line and column are not selectable and the groupable option seems to not work too.

Thanks for your help.
Matt
Top achievements
Rank 1
 answered on 16 May 2013
2 answers
781 views
How to add a new row at the bottom of the grid instead of the first row?
Dan
Top achievements
Rank 1
 answered on 15 May 2013
1 answer
678 views
Dear KendoUI Team!
I hope you can help me. I got the following problem:
when using kendo.toString to format a number.

The following line inside the ClientDetailTemplate for a grid Column leads to an 'invalid template' error:
(BAD:)
columns.Bound(o => o.Price).Title(Strings.di_Price).ClientTemplate("#= kendo.toString(Price, \"n2\") #");
or
columns.Bound(o => o.Price).Title(Strings.di_Price).ClientTemplate("#= kendo.toString(Price, 'n2') #");

while this is OK:
(GOOD:)
columns.Bound(o => o.Price).Title(Strings.di_Price).ClientTemplate("#= kendo.toString(Price) #");

Here is the line in the model

        [DataType("Number")]
        public decimal Price { get; set; }

But I want to format the column. In the main grid, I can use .toString() like described. But in the ClientDetailTemplate it fails.
What can I do to format the output in ClientDetailTemplate?

brgds
Malcolm Howlett
Nikolay Rusev
Telerik team
 answered on 15 May 2013
1 answer
51 views
Run the examples app in FF, pull up any grid example.  Start firebug.  Click edit button - POOF - grd elements disappear.
error shows up in firebug - TypeError: ot.jQuery(...).handler is not a function - kendo.web.min.js (line 9)

Any advice - I would like to use firebug to debug my apps!
Atanas Korchev
Telerik team
 answered on 15 May 2013
2 answers
218 views
Scenario.

1.  Create a new KendoUI MVC 4 application.
2.  Copy the NorthwindDB, Controller, View, Model and supporting classes for the Grid Editing_Inline example code found from the KendoUI MVC examples install.
3. Build and run - Grid comes up, I can sort and page and add new record. 
THE ISSUE:  When I click edit - the row changes and allows me to change values.  I make sure I change some to make it dirty.  I then click Update.  I can confirm (through a breakpoint) that the Controllor Action EditingInline_Update is hit.
HOWEVER- the Grid Row DOES NOT Change back to a non-edit mode. 

I have tried all sorts of things - updating the jquery version. Making sure my script references match the examples project, etc etc.

WHAT AM I missing??
Marc Samale
Top achievements
Rank 1
 answered on 14 May 2013
1 answer
291 views
Why the DropDownList .Value() method changes the value of the <input> element, but not displaying it. I saw that it displays some value in a <span> element that I don't know how to change. When I use DropDownListFor(x => x.UserName) I want my default value to be what I have in the Model. My question is how to set the default value of a DropDownList?
Georgi Krustev
Telerik team
 answered on 14 May 2013
3 answers
417 views
Hi

I saw the below link

http://demos.kendoui.com/web/combobox/cascadingcombobox.html

i have three combo box

@(Html.Kendo().ComboBox()
.Name("userComboBox") //The name of the combobox is mandatory. It specifies the "id" attribute of the widget.
.DataTextField("UserName") //Specifies which property of the Product to be used by the combobox as a text.
.DataValueField("UserID") //Specifies which property of the Product to be used by the combobox as a value.
.Filter(FilterType.StartsWith)
.Placeholder("Select Name...")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetUsers", "UserDetails").Data("onAdditionalData"); //Set the Action and Controller name
})
.ServerFiltering(true); //If true the DataSource will not filter the data on the client.

}).Events(e=>e.Change("combobox_change"))




//Select first item.
)

@(Html.Kendo().ComboBox().Name("entityDetails")
.DataTextField("EntityName")
.DataValueField("EntityID")
.DataSource(source => {
source.Read(read =>
{
read.Action("GetEntity", "UserDetails").Data("onAdditionalDataEntity");
})

.ServerFiltering(true);
}) .SelectedIndex(0)
.CascadeFrom("userComboBox")



)

@(Html.Kendo().ComboBox().Name("ClientDetails")
.DataTextField("ClientName")
.DataValueField("ClientID")
.DataSource(source => {
source.Read(read =>
{
read.Action("GetClientDetails", "UserDetails").Data("onAdditionalDataForClient");
})
.ServerFiltering(true);
})
.SelectedIndex(0)
.CascadeFrom("userComboBox")
)

//js
function onAdditionalData() {
var data = $("#userComboBox").data("kendoComboBox")
value1 = data.input.val();
return {
text: value1

};

}
function onAdditionalDataEntity() {
var data = $("#userComboBox").data("kendoComboBox")
value1 = $("#userComboBox").val();
return {
userData: value1,
entity: $("#entityDetails").data("kendoComboBox").input.val()

};

}
function onAdditionalDataForClient() {
var data = $("#userComboBox").data("kendoComboBox")
value1 = $("#userComboBox").val();
return {
userData: value1,
entity: $("#ClientDetails").data("kendoComboBox").input.val()
};

}

//controller
public JsonResult GetUsers(string text)
{
return Json(GetActiveUser, JsonRequestBehavior.AllowGet);
}

public JsonResult GetClientDetails(string userData, string entity)
{
 
// return userDetailsDAO.GetUserDetails(id);
return Json(GetClientDetails, JsonRequestBehavior.AllowGet);
}
public JsonResult GetEntity(string userData, string entity)
{
 
return Json(GetEntityDetails, JsonRequestBehavior.AllowGet);
}





1) user combo box need to cascade with other two so when i load user combo i need to load and select details
2) i can do load but cant select the first item

Can you guys help me

Senthil
Vladimir Iliev
Telerik team
 answered on 14 May 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?