I'm running into a number of issues trying to do validation of controls in a popup form template of a radGrid:
1) None of my client-side validation funtions are firing
2) I cannot get the NEW value of the radEditor in my server-side custom validation function
3) When the insert form is redisplayed with errors, the content of the radEditor displays the original value, not the new value (changes are lost)
I'm using IE 9.0, and radControls Q3 2012.
This is the code for two of my editor controls that are having an issue (and the update button):
These are my client-side validation functions (neither of which gets fired):
And these are my server-side validation functions:
Both of the debug statements for the cvTitle validator display the correct value for the Title field, but neither debug statement for the cvItemText validator displays the new values, they display the old value.
1) None of my client-side validation funtions are firing
2) I cannot get the NEW value of the radEditor in my server-side custom validation function
3) When the insert form is redisplayed with errors, the content of the radEditor displays the original value, not the new value (changes are lost)
I'm using IE 9.0, and radControls Q3 2012.
This is the code for two of my editor controls that are having an issue (and the update button):
<telerik:RadTextBox ID="rtbTItle" runat="server" Width="400" TextMode="SingleLine" Text='<%# DataBinder.Eval(Container, "DataItem.Title") %>' Skin="WebBlue"></telerik:RadTextBox><asp:RequiredFieldValidator ID="rfvTitle" runat="server" ControlToValidate="rtbTitle" ErrorMessage="You must enter a Title" ValidationGroup="vgEditor" ForeColor="Red" Font-Bold="true">*</asp:RequiredFieldValidator><asp:CustomValidator ID="cvTitle" runat="server" ControlToValidate="rtbTitle" ClientValidationFunction="cvTitle_Validator" OnServerValidate="cvTitle_ServerValidate" EnableClientScript="true" ErrorMessage="Title cannot contain 'x'" ValidationGroup="vgEditor" ForeColor="Red" Font-Bold="true">x</asp:CustomValidator><telerik:RadEditor ID="reItemText" runat="server" BorderStyle="None" OnClientLoad="reItemText_OnClientLoad" OnClientModeChange="reItemText_OnClientModeChange" Width="800" Height="300" AutoResizeHeight="false" EnableResize="false" ToolsWidth="800" ContentAreaMode="Div" Skin="WebBlue" Content='<%# DataBinder.Eval(Container, "DataItem.ItemText") %>'></telerik:RadEditor><asp:CustomValidator ID="cvItemText" runat="server" ControlToValidate="reItemText" ClientValidationFunction="cvItemText_Validator" OnServerValidate="cvItemText_ServerValidate" EnableClientScript="true" ErrorMessage="Item Text is required" ValidateEmptyText="true" ValidationGroup="vgEditor" ForeColor="Red" Font-Bold="true">*</asp:CustomValidator><asp:Button ID="btnUpdate" runat="server" ValidationGroup="vgEditor" CausesValidation="true" Text='<%# IIf(TypeOf Container is GridEditFormInsertItem, "Insert", "Update") %>' CommandName='<%# IIf(TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>' />These are my client-side validation functions (neither of which gets fired):
function cvItemText_Validator( sender, args ) { console.log( "cvItemText_Validator" );}function cvTitle_ServerValidate( sender, args ) { console.log( "cvTitle_ServerValidate" );}And these are my server-side validation functions:
Protected Sub cvItemText_ServerValidate(source As Object, args As System.Web.UI.WebControls.ServerValidateEventArgs) System.Diagnostics.Debug.WriteLine("Admin_ManageNews:cvItemText_ServerValidate") System.Diagnostics.Debug.WriteLine(String.Format(" ItemText: {0}", args.Value)) Dim oItem As GridEditableItem = DirectCast(DirectCast(source, CustomValidator).NamingContainer, GridEditableItem) Dim oEditor As RadEditor = DirectCast(oItem.FindControl("reItemText"), RadEditor) System.Diagnostics.Debug.WriteLine(String.Format(" ItemText: {0}", oEditor.Content))End SubProtected Sub cvTitle_ServerValidate(source As Object, args As System.Web.UI.WebControls.ServerValidateEventArgs) System.Diagnostics.Debug.WriteLine("Admin_ManageNews:cvTitle_ServerValidate") System.Diagnostics.Debug.WriteLine(String.Format(" Title: {0}", args.Value)) Dim oItem As GridEditableItem = DirectCast(DirectCast(source, CustomValidator).NamingContainer, GridEditableItem) Dim oRTB As RadTextBox = DirectCast(oItem.FindControl("rtbTitle"), RadTextBox) System.Diagnostics.Debug.WriteLine(String.Format(" Title: {0}", oRTB.Text))End SubBoth of the debug statements for the cvTitle validator display the correct value for the Title field, but neither debug statement for the cvItemText validator displays the new values, they display the old value.