I have a RadGrid that takes data from a business object of some sort. I use the Microsoft Enterprise Library 4.1 to conduct validation on the object by decorating with a [HasValidation] attribute and handling accordingly.
I'm having problems working out how to just pass back validation errors without ending the insert / update process. I'll elaborate.
For:
OnUpdateCommand="TelerikGrid_OnUpdateCommand"I have:
protected void TelerikGrid_OnUpdateCommand(object source, GridCommandEventArgs e) { this.businessObject = new BusinessObject(); this.businessObject.GetGridValues(e); var validationResults = Validation.Validate(this.businessObject); if (validationResults.IsValid) { this.businessObjectData = new BusinessObjectData(); int updateResult = this.businessObjectData.Update(this.businessObject); switch (updateResult) { case -1: this.Master.FeedbackText = "Not updated."; break; default: this.Master.FeedbackText = "Updated."; break; } } else { this.Master.FeedbackText = string.Format( "Errors found in submission: {0}", ValidationHelper.GetErrors(validationResults, false)); } } Everything works very well but if there are validation errors, the errors are displayed but the grid appears to rebind, collapsing the edit form and losing all the entered values in the process.
How can I retain the values entered and stop the edit form collapsing when the data fails validation?
Regards,
Richard
<rad:RadGrid runat="server" id="RadGrid1" OnSelectedIndexChanged="grdGrid_OnSelectedIndexChanged" AutoGenerateColumns="false" > <MasterTableView> <Columns> <rad:GridButtonColumn ImageUrl="edit_16.gif" CommandName="Select" ButtonType="ImageButton" HeaderText="Edit"/> </Columns> </MasterTableView> <ClientSettings> <Selecting AllowRowSelect="true" /> </ClientSettings> </rad:RadGrid> <rad:RadTabStrip ID="RadTabStrip1" Width="300px" style="margin:5px" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0" Align="Justify" > <Tabs> <rad:RadTab Text="Details" > </rad:RadTab> <rad:RadTab Text="Activity" > </rad:RadTab> </Tabs> </rad:RadTabStrip> <rad:RadMultiPage runat="server" ID="RadMultiPage2" > <rad:RadPageView runat="server" ID="RadPageView3" Selected="true"> <asp:Label runat="server" ID="Label1" /> </rad:RadPageView> <rad:RadPageView runat="server" ID="RadPageView4" > </rad:RadPageView> </rad:RadMultiPage> <rad:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"> <AjaxSettings> <rad:AjaxSetting AjaxControlID="RadGrid1" > <UpdatedControls> <rad:AjaxUpdatedControl ControlID="RadMultiPage2" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </rad:AjaxSetting> </AjaxSettings> </rad:RadAjaxManagerProxy><ResourceTypes> <telerik:ResourceType DataSourceID="edsCategories" ForeignKeyField="CategoryID" KeyField="CategoryID" Name="Category" TextField="Category" />
</ResourceTypes> <asp:EntityDataSource ID="edsCategories" runat="server" ConnectionString="name=ProNetData" DefaultContainerName="ProNetData" EntitySetName="AppointmentCategories"> </asp:EntityDataSource>I am getting “Micorsoft Jscript runtime error: Object required” error when I try to refer the .js file that refer a Radcontrol. ie.,"document.getElementById('<%=txtTime.ClientID%>')." Please let me know where i am going wrong. Any help is appreciated.
I originally have the following JavaScript function in the content page and worked just fine. Now I am trying to move my java script to .js file.
I have the RadScriptManager on the master page. I do not want to load the .js code at the master page, so I added a ScriptManagerProxy in my content page as below.
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Scripts>
<asp:ScriptReference Path="../JavaScript/test.js" />
</Scripts>
</asp:ScriptManagerProxy>
Sample Content of my test.js file
function getTime(sender, args){
var strTime =document.getElementById('<%=txtTime.ClientID%>').value;
args.IsValid = true;
}
Thanks in advance.
| RadChart for ASP.NET AJAX Q2 2008 | Send comments on this topic. |
| Telerik.Charting. | |
| Troubleshooting > Telerik.Charting. |
When upgrading existing telerik RadControls applications (which include RadChart) to RadControls for ASP.NET AJAX you may get the following error:
Error 1 The type 'Telerik.Charting.<SomeType> exists in both 'c:\WINDOWS\assembly\GAC_MSIL\Telerik.Charting\...\Telerik.Charting.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\...\RadChart.Net2.DLL'
The reason for this error is because RadChart (3.x and later) and RadControls for ASP.NET AJAX Chart use shared code.he shared code is in the form of Telerik.Charting.dll assembly which is ILMerged in the RadChart.Net2.dll for backwards compatibility reasons and is shipped separately for RadControls for ASP.NET AJAX.
The error will manifest itself whenever you attempt to reference BOTH RadChart.Net2.dll and Telerik.Charting.dll. There are two ways to resolve the issue:
Please have in mind that RadChart for ASP.NET AJAX and RadChart 4.x have 99% identical functionality. It is up to your personal preference to decide which one you would like to use. The most significant difference is the assembly name and the fact that RadChart for ASP.NET AJAX uses an HttpHandler to display images and RadChart 4.x still uses RadControls\Image.aspx for backwards compatibility reasons.