gpt4 book ai didi

c# - 内联编辑验证

转载 作者:太空宇宙 更新时间:2023-11-03 16:09:41 26 4
gpt4 key购买 nike

我有一个剑道网格。我想在那里添加内联编辑验证。

下面是我的剑道网格的屏幕截图:

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) 客户端模板。

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("添加新媒体"); })

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) 通过命令:-

我也试过这个:-

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

但它没有验证该字段。但我能够将其保存在数据库中。

最佳答案

你可以在下拉更改事件中做到这一点

看看这个 fiddle

将人员“Dave”更改为软件工程师以查看验证工作。

你可以自定义 onSelect 事件中的验证

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");

}

关于c# - 内联编辑验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18009624/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com