2

I have a kendo grid.And i want to add inline editing validation there.

Below is the screen shot of my kendo grid:

enter image description here

According to my functionality i want to validate the "Media" filed according to "Media Type" field.

We have 4 Media Types(Email,WebURL,Facebook,Twitter).

And the Media field string should be according to selected Media Type.For example:

1) For Email Media Type :   amit@gmail.com
2) For WebURL Media Type:   www.yahoo.com

And if someone entered invalid Media string according to selected Media Type then i want to show validation message.It can be MVC model validation or Javascript validation.

I have tried with two know ways.But none of helping me.

1) The client template.

In which i have used client template for Add Net Item button to validate the Media field.And for that i have handle it by Javascript function.Please have a look below :-

.ToolBar(commands => { commands.Template("Add New Media"); })

By this i was able to validate the field.But was unable to save it in database.Means i don't know the way to call Saving method by this.

2) By Commands:-

I have tried this also :-

.ToolBar(commands =>
                       {
                           commands.Create();
                           commands.Save();
                       })

But it was not validating the field.But i was able to save it in database.

csharpwinphonexaml
  • 3,659
  • 10
  • 32
  • 63
Pawan
  • 2,150
  • 11
  • 45
  • 73
  • Not a question, just specification. Is it a request? – Kamil Budziewski Aug 02 '13 at 05:53
  • What do you means,its a request ? I have this issue and i want to know solution for that. – Pawan Aug 02 '13 at 06:09
  • 1
    You haven't mentioned any problems with making that. Just wrote what you want. Have you even tried? Show your effort and precise what part of task you don't understand. Now it looks like: "I want to do ... make it for me" <- does it look like a question? – Kamil Budziewski Aug 02 '13 at 06:11
  • Sure,just have a look again.I am updating the question. – Pawan Aug 02 '13 at 06:56

1 Answers1

0

u can do that in dropdown change event

Check out this fiddle

Change the person "Dave" to Software engineer to see the validation work.

u can customise the validation in onSelect event

function onSelect(e) {

var name = $('td:first', $(e.sender.element).closest("tr")).text();
var dataItema = this.dataItem(e.item.index());

if ((this.dataSource.data()[e.item.index()].title) == 'Software Engineer') {
    if (name == 'Dave') {
        $('td:first', $(e.sender.element).closest("tr")).addClass('error');
    }
}

//var id = e.item.find("span").attr("data-id");

}
karthickj25
  • 1,207
  • 9
  • 16