I am using version 2011.1.519.35 of your ASP.NET for AJAX controls.
My problem is that client-side validation isn't firing when I click a linkbutton in the CommandItemTemplate.
My grid has a CommandItemTemplate which contains linkbuttons to put the grid into add or edit mode, and a button to save rows that are in add or edit mode. See below:
<
CommandItemTemplate
>
<
div
class
=
"gridCommandItemRow"
>
<
asp:LinkButton
runat
=
"server"
ID
=
"AddNew"
Text
=
"Add New"
CssClass
=
"add"
CommandName
=
"InitInsert"
Visible="<%# Not TeamMetricsRadGrid.MasterTableView.IsItemInserted %>" />
<
asp:LinkButton
runat
=
"server"
ID
=
"UpdateAll"
Text
=
"Save All"
CssClass
=
"save"
CommandName
=
"SaveAll"
CausesValidation
=
"true"
/>
</
div
>
</
CommandItemTemplate
>
I also have the following line in the grid, to try to get validation to work:
<
ValidationSettings
CommandsToValidate
=
"SaveAll,PerformInsert,Update"
ValidationGroup
=
"TeamMetricsValidationGroup"
/>
I have asp.net required field validator controls on several of the controls within EditItemTemplates.
Prior to using my own linkbuttons in the CommandItemTemplate, I was using the built-in Add / Edit buttons supplied by the GridEditCommandColumn. When I did this, the client-side validation was firing correctly, and preventing the postback as expected.
But my linkbutton in the CommandItemTemplate, with the CommandName of "SaveAll" is NOT firing client-side validation. It does a postback without validation.
I thought I could set CausesValidation="true" for that button, and add that button's CommandName to the CommandsToValidate property, as I've done above, but that didn't work. Does the grid validation not work with CommandNames from other buttons, in the CommandToValidate property, like I've done?
What am I missing? Is it possible to fire client-side validation from buttons in the CommandItemTemplate?
Thanks,
Michael