TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pravin More
NA
2.7k
187.7k
Telerik: Discard newly added unsaved row on sort grid column
Oct 26 2016 3:55 AM
I am using telerik grid in my mvc web application.
My Scinario is like-
1.I click "add new row" option which adds empty row in my grid.
2. Then I click on sort one of column without saving newly added row.
So this sort saves newly added row automatically.I want to override this behavior by discarding unsaved row.
Let me know how to do this.
Below is my grid defination:
@(Html.Kendo().Grid<ProviderLanguageInfo>()
.Name(
"LanguageGrid"
)
.Columns(columns =>
{
columns.Bound(p => p.ProviderLanguageId).Visible(
false
);
columns.Bound(p => p.HealthSystemId).Visible(
false
);
columns.Bound(p => p.ProviderId).Visible(
false
);
columns.Bound(p => p.IsDeleted).Visible(
false
);
columns.Bound(p => p.Language).ClientTemplate(
"#=Language.LanguageName#"
).Title(
"Language"
).EditorTemplateName(
"LanguageList"
);
columns.Bound(p => p.LanguageAbility).ClientTemplate(
"#=LanguageAbility.LanguageAbilityTypeName#"
).Title(
"Ability"
).EditorTemplateName(
"LanguageAbilityList"
);
columns.Bound(p => p.LanguageProficiency).ClientTemplate(
"#=LanguageProficiency.LanguageProficiencyTypeName#"
).Title(
"Proficiency"
).EditorTemplateName(
"LanguageProficiencyList"
);
if
(hasRights)
columns.Command(command =>
{
command.Edit();
command.Destroy();
}).Width(250).Title(
"Action"
);
})
.ToolBar(toolbar => {
if
(hasRights) toolbar.Create().Text(
"Add New Language"
); })
.Events(evt =>
{
evt.Edit(
"onGridEdit"
);
evt.DataBound(
"onGridDataBound"
);
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Scrollable()
.Sortable()
.HtmlAttributes(
new
{style =
"height:110px;"
})
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(
false
)
.PageSize(3)
.Events(events =>
{
//events.Error("error_handler");
events.RequestEnd(
"onGridRequestEnd"
);
})
.Model(model =>
{
model.Id(p => p.ProviderLanguageId);
model.Field(p => p.Language).DefaultValue(defaultLanguage);
model.Field(p => p.LanguageAbility).DefaultValue(defaultAbility);
model.Field(p => p.LanguageProficiency).DefaultValue(defaultProficiency);
model.Field(p => p.ProviderId).DefaultValue(Model.ProviderId);
model.Field(p => p.HealthSystemId).DefaultValue(Model.HealthSystemId);
})
.Read(read => read.Action(
"GetProviderLanguages"
,
"Language"
,
new
{providerId = Model.ProviderId}))
.Update(update => update.Action(
"UpdateLanguage"
,
"Language"
))
.Destroy(destroy => destroy.Action(
"DeleteLanguage"
,
"Language"
))
.Create(create => create.Action(
"CreateLanguage"
,
"Language"
))
)
)
Reply
Answers (
1
)
What is difference between MVC 5 and MVC 6.
gridview2 under form tag