latest posts

After updating a large ASP.NET 4.5 WebForms Friday, this afternoon I started to take a look into the new features in the release and discovered the "lightweight" rendering mode of the RadWindow control. Previously - going back to 2011/2012 one of my biggest complaints with the RadWindow was the hacking involved in order to make the popup appear relatively the same across Internet Explorer 9, Chrome and Firefox. Some back and forth with Telerik's Support left much to be desired, so I ended up just padding the bottom and it more or less worked. Thus my excitement for a possible fix to this old problem - turns out the new lightweight mode does infact solve the issue, across Internet Explorer 11, Firefox and Chrome there are only minimal differences now for my popups content (W3C Validated DIVs for the most part).

This is where the fun ended for me temporarily - in the Q2 2013 (2013.2.717.45) release, the h6 tag for the Title was empty:

I immediately pulled open the Internet Explorer 11 Developer Tool Inspector and found this curious:
Not enjoying hacking Control Suites, but needed to implement a fix ASAP so I could continue development, I simply put this CSS Override in my WebForm's CSS Theme File: [css] .RadWindow_Glow .rwTitleWrapper .rwTitle { width: 100% !important; } [/css] Depending on the Skin you selected, you will need to update the name of the class. Hope that helps someone out there - according to the forums, it is a known issue and will be in the Q2 SP1 2013 Release, but in the mean time this will correct the issue.
Had an interesting situation with a pretty extensive Ajax/Telerik ASP.NET 4.5 page where one of the RadPageViews could grow to a pretty sizeable height and the requirement was to have the Submit Button at the very bottom (not sure why in retrospect). Part of the problem was the RadLoadingPanel wasn't expanding to the infinite height of the RadPageVIew. So what you got was only the original height of the RadPageView and since you were at the bottom of the page, you had no indication that the post-back was actually occurring. I am sure you could probably update the height of the RadAjaxLoadingPanel through some JavaScript, but I chose to do the easier approach, simply scroll to the top and then do the post back on my Submit Button. If you had a ton of buttons on a page, you would probably want to rework the JavaScript function to accept the Button's ID and simply call the JavaScript in your Button's OnClientClick event. Some where in your ASPX file: [javascript] <telerik:RadCodeBlock runat="server"> <script type="text/javascript"> function focusTopAndSubmit() { window.scrollTo(0, 0); __doPostBack("<%=btnSubmit.UniqueID %>", ""); } </script> </telerik:RadCodeBlock> [/javascript] And then in your actual ASP:Button or Telerik:RadButton definition: [csharp] <asp:Button ID="btnSubmit" OnClientClick="focusTopAndSubmit(); return false;" OnClick="btnSubmit_Click" runat="server" Text="Submit" /> [/csharp] Update the JavaScript postback line with the name of your Submit Button, but other then that, it's drop in ready.
I had an unusual issue that came to my attention this week in regards to using Telerik's RadGrid for displaying a long list of items, in this case 83, when the pagination size was set to 100, as expected the page height grew exponentially over the initial 425px height for this particular RadPageView. On this particular RadGrid my far right hand column had an edit column in which a RadWindow would open to a one field, two button page. Redirecting to an entirely new page made no sense in this situation, thus why I went with the RadWindow control in the first place. Before I dive into the issue and the solution I came up with, you can download the full source code for this post here. For this example I am using a pretty common situation, listing all of the users with their email address and "IDs": [caption id="attachment_1791" align="aligncenter" width="300"]Telerik RadGrid with a PageSize of 10 Telerik RadGrid with a PageSize of 10[/caption] With the Edit User LinkButton opening a RadWindow indicating you can Edit the User's ID: [caption id="attachment_1794" align="aligncenter" width="300"]Telerik RadGrid with RadWindow Telerik RadGrid with RadWindow[/caption] So where does the problem lie? When you have a PageSize high or any content that expands far more than what is visible initially and you open your RadWindow: [caption id="attachment_1795" align="aligncenter" width="300"]Telerik RadGrid with PageSize set to 50 Telerik RadGrid with PageSize set to 50[/caption] The RadWindow appears where you would expect it to if you were still at the top of the page. So can you fix this so the RadWindow appears in the center of the visible area of your browser no matter how far down you are? On your OnItemDataBound code behind: [csharp] protected void rgMain_OnItemDataBound(object sender, GridItemEventArgs e) { if (!(e.Item is GridDataItem)) { return; } var linkButton = (LinkButton) e.Item.FindControl("lbEdit"); var user = ((e.Item as GridDataItem).DataItem is USERS ? (USERS) (e.Item as GridDataItem).DataItem : new USERS()); linkButton.Attributes["href"] = "javascript:void(0);"; linkButton.Attributes["onclick"] = String.Format("return openEditUserWindow('{0}');", user.ID); } [/csharp] The important line here is the linkButton.Attributes["href"] = "javascript:void(0);";. Something else I choose to do in these scenarios where I have a popup is to offer the user a cancel button and a save button, but only refreshing the main window object that needs to be updated. In this case a RadGrid. To achieve this, you need to pass an argument back to the RadWindow from your Popup ASPX Page to indicate when a refresh is necessary. The ASPX for your popup: [csharp] <div style="width: 300px;"> <telerik:RadAjaxPanel runat="server"> <telerik:RadTextBox runat="server" Width="250px" Label="UserID" ID="rTxtBxUserID" /> <div style="padding-top: 10px;"> <div style="float:left;"> <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="Close();return false;" /> </div> <div style="float:right"> <asp:Button ID="btnSave" runat="server" OnClientClick="CloseAndSave(); return false;" OnClick="btnSave_Click" Font-Size="14px" Text="Save User" /> </div> </div> </telerik:RadAjaxPanel> </div> [/csharp] The JavaScript in your ASPX Popup Page: [jscript] <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> function GetRadWindow() { var oWindow = null; if (window.radWindow) { oWindow = window.radWindow; } else if (window.frameElement.radWindow) { oWindow = window.frameElement.radWindow; } return oWindow; } function Close() { GetRadWindow().close(); } function CloseAndSave() { __doPostBack("<%=btnSave.UniqueID %>", ""); GetRadWindow().close(1); } </script> </telerik:RadScriptBlock> [/jscript] Then in your main page's ASPX: [jscript] <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> function openEditUserWindow(UserID) { var oWnd = radopen('/edituser_popup.aspx?UserID=' + UserID, "rwEditUser"); } function OnClientClose(oWnd, args) { var arg = args.get_argument(); if (arg) { var masterTable = $find('<%= rgMain.ClientID %>').get_masterTableView(); masterTable.rebind(); } } </script> </telerik:RadScriptBlock> [/jscript] With this your RadGrid will only refresh if the user hits save on your popup as opposed to doing a costly full post back even if the user didn't make any changes. I hope that helps someone out there who struggled to achieve everything I mentioned in full swoop. Telerik has some great examples on their site, but occasionally it can take some time getting them all working properly. As mentioned above, you can download the full source code for this solution here.
Recently I upgraded a fairly large Windows Forms .NET 4 app to the latest version of the Windows Forms Control Suite (2012.3.1211.40) and got a few bug reports from end users saying when they were doing an action that updated the Tree View Control it was throwing an exception. At first I thought maybe the Clear() function no longer worked as intended so I tried the following: [csharp] if(treeViewQuestions != null&& treeViewQuestions.Nodes != null&& treeViewQuestions.Nodes.Count > 0) { for(intx = 0; x < treeViewQuestions.Nodes.Count; x++) { treeViewQuestions.Nodes[x].Remove(); } } [/csharp] No dice. Digging into the error a big further, I noticed the "UpdateLine" function was the root cause of the issue: Telerik.WinControls.UI.TreeNodeLinesContainer.UpdateLine(TreeNodeLineElement lineElement, RadTreeNode node, RadTreeNode nextNode, TreeNodeElement lastNode)\r\n at Telerik.WinControls.UI.TreeNodeLinesContainer.UpdateLines()\r\n at Telerik.WinControls.UI.TreeNodeLinesContainer.Synchronize()\r\n at Telerik.WinControls.UI.TreeNodeElement.Synchronize()\r\n at Telerik.WinControls.UI.RadTreeViewElement.SynchronizeNodeElements()\r\n at Telerik.WinControls.UI.RadTreeViewElement.Update(UpdateActions updateAction)\r\n at Telerik.WinControls.UI.RadTreeViewElement.ProcessCurrentNode(RadTreeNode node, Boolean clearSelection)\r\n at Telerik.WinControls.UI.RadTreeNode.OnNotifyPropertyChanged(PropertyChangedEventArgs args)\r\n at Telerik.WinControls.UI.RadTreeNode.SetBooleanProperty(String propertyName, Int32 propertyKey, Boolean value)\r\n at Telerik.WinControls.UI.RadTreeNode.set_Current(Boolean value)\r\n at Telerik.WinControls.UI.RadTreeNode.ClearChildrenState()\r\n at Telerik.WinControls.UI.RadTreeNode.set_Parent(RadTreeNode value)\r\n at Telerik.WinControls.UI.RadTreeNodeCollection.RemoveItem(Int32 index)\r\n at System.Collections.ObjectModel.Collection`1.Remove(T item)\r\n at Telerik.WinControls.UI.RadTreeNode.Remove() Remembering I had turned on the ShowLines property, I humored the idea of turning them off for the clearing/removing of the nodes and then turning them back on like so: [csharp] treeViewQuestions.ShowLines = false; treeViewQuestions.Nodes.Clear(); treeViewQuestions.ShowLines = true; [/csharp] Sure enough that cured the problem, the last word I got back from Telerik was that this is the approved workaround, but no ETA on a true fix. Hopefully that helps someone else out there.
You might be getting this error:
web.ui.webresource.axd The status code returned from the server was: 500
in your Telerik ASP.NET Web application. Took some searching/trial and error, but one of these steps by solve your problem:
  1. Try making sure <%@ Page> directive has ValidateRequest="false"
  2. Try switching your IIS ASP.NET 4 to run in Classic Mode
  3. Remove all RadAjaxManager, RadAjaxLoadingPanels and RadAjaxPanels from your ASPX page
For my solution all I needed to do was remove the RadAjax controls in order for a particular page with a couple RadDatePicker, RadButtons and a RadGrid. Still don't know why it occurred, but I'm glad it is working now. Hopefully this helps someone.
I've been using Telerik's ASP.NET AJAX Control Suite for 3.5 years now and I am happy to say I've run into very little issues, especially in the WinForm control suite that I have used more extensively than the ASP.NET suite. This brings me to a little issue I ran into today. I had 150 rows or so to display in a RadGrid Control. Remembering the average user at my company is probably running Windows 7 @ 1024x768 and with 125% font, I knew having it all listed in one page wouldn't make sense. This is one of the areas where the legacy .NET 1.1 system in comparison to this new project really shows its age. So I turned to the built in pagination support in the RadGrid. In the past all that required was something like this: [csharp] <telerik:RadGrid ID="rgRoles" runat="server" EnableEmbeddedSkins="False" OnItemCommand="rgRoles_ItemCommand" OnNeedDataSource="rgRoles_NeedDataSource" AllowPaging="true" PageSize="25"> <MasterTableView AutoGenerateColumns="false"> <Columns> <telerik:GridBoundColumn ReadOnly="true" DataField="UserID" Visible="false" /> <telerik:GridBoundColumn HeaderText="User" ReadOnly="true" DataField="Name" /> </Columns> </MasterTableView> </telerik:RadGrid> [/csharp] And then further up, hook up the RadGrid Control to itself for AJAX Requests: [csharp] <telerik:RadAjaxManager ID="ramMain" runat="server" DefaultLoadingPanelID="ralpMain"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="rgRoles"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="rgRoles" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> [/csharp] To my surprise this didn't work as it had in the past when using the preferred data binding approach of using the OnNeedDataSource property. The pagination numbers were showing as expected, but clicking on the individual page numbers only refreshed to the first page. I then thought, ok maybe it was because I wasn't explicitly stating the PagerStyle, so I added this line in between my RadGrid declaration and the MasterTableView line: [csharp] <PagerStyle Mode="NumericPages" /> [/csharp] However it was still only refreshing to the first page. About to submit a help ticket to Telerik, I thought, maybe it was me not enabling Sorting? Updated my declaration to: [csharp] <telerik:RadGrid ID="rgRoles" runat="server" EnableEmbeddedSkins="False" OnItemCommand="rgRoles_ItemCommand" AllowSorting="true" OnNeedDataSource="rgRoles_NeedDataSource" AllowPaging="true" PageSize="25"> <MasterTableView AutoGenerateColumns="false"> <Columns> <telerik:GridBoundColumn ReadOnly="true" DataField="UserID" Visible="false" /> <telerik:GridBoundColumn HeaderText="User" ReadOnly="true" DataField="Name" /> </Columns> </MasterTableView> </telerik:RadGrid> [/csharp] Sure enough it worked. I am wondering why that isn't in the documentation as a troubleshooting solution along with the other entries, but my bigger question I wonder what the reasoning for the requirement of Sorting to be enabled for pagination? Or at least in the latest Q2 2012 release? Hope that helped someone else out there struggling to get an AJAX Pagination Enabled RadGrid working.
After playing around with Google Charts and doing some extensive C#/SQL integration with it for a dashboard last summer, I figured I'd give Telerik's Kendo a shot. If you're not familiar with Telerik, they produce very useful controls for WinForm, WPF, WP7 and ASP.NET controls (in addition to many others). If you do .NET programming, their product will save you time and money guaranteed. That being said, I started work on the first module for jcDAL last night and wanted to add some cool bar graphs to the web interface for the analyzer. About 15 minutes of reading through one of their examples I had data coming over a WCF service into the Kendo API to display this: [caption id="attachment_880" align="aligncenter" width="621" caption="jcDBAnalyzer Screengrab showcasing Kendo"][/caption] So far so good, I'll report back with any issues, but so far I am very pleased. A lot of the headaches I had with Google Charts I haven't had yet (+1 for Telerik).