Migrating from Telerik.WebControls.RadGrid (RadGrid.Net2.dll) to Telerik.Web.UI.RadGrid (Telerik.Web.UI.dll Q2 2016)

2 posts, 0 answers
  1. Philip Gaffney
    Philip Gaffney avatar
    2 posts
    Member since:
    Jun 2013

    Posted 13 May 2016 Link to this post

    I'm currently going through updating an application that was using RadGrid.Net2 and RadChart.Net2, to be using the latest release of Telerik ASP.NET AJAX Grid and Chart controls.

    So far I've encountered numerous issues with skinning of the Grid, and am now experiencing issues with some of the databinding and controls usage for the grid which I'm hoping you could advise on.

    One of the failing instances of the RadGrid used to use the following code:-

    <radG:RadGrid id="GridOutcomes" runat="server" AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False" GridLines="None" Skin="Default" OnNeedDataSource="GridOutcomes_NeedDataSource" OnItemCommand="GridOutcomes_ItemCommand" OnItemDataBound="GridOutcomes_ItemDataBound" Visible="False">
    <MasterTableView DataSourcePersistenceMode="NoPersistence">
    <radG:GridBoundColumn DataField="ID" HeaderText="Case" UniqueName="columnId" Visible="False" />                                <radG:GridTemplateColumn DataField="GmcCode" HeaderText="GMC" UniqueName="columnGMC" SortExpression="GmcCode">                         <ItemStyle HorizontalAlign="Left" />
        <HeaderStyle HorizontalAlign="Left" />
               <des:Button ID="ButtonDrillDown" runat="server" CssClass="linkButtonNoValidate showInPrint" CommandName="DrillDown" Text='<%#((string)Eval("GmcCode")) + "&nbsp;"%>' CausesValidation="false" />
    <radG:GridBoundColumn DataField="FormattedName" HeaderText="Name" UniqueName="columnName" />
    <PagerStyle Mode="NextPrevAndNumeric" />

    With the Telerik DLLs updated, I've noticed that the 'DataSourcePersistenceMode' property is no longer valid for the MasterTableView.

    Also, when the application runs, clicking on one of the row buttons which calls 'GridOutcomes_ItemCommand' no longer is able to extract the correct value from the grid, and the value returned is the Empty Cell Default Value.

    01.protected void GridOutcomes_ItemCommand(object source, GridCommandEventArgs e)
    03.    Logger.Write(User.Identity.Name + ": SearchPersonnel:GridOutcomes_ItemCommand", Defines.LoggingCategoryMain);
    05.    switch(e.CommandName)
    06.    {
    07.        case "DrillDown":
    08.            try
    09.            {
    10.                GridDataItem gridItem = e.Item as GridDataItem;
    11.                TableCell cell = gridItem[GridOutcomes.Columns[(int)GridColumn.PersonnelId].UniqueName];
    13.                int personnelId = 0;
    14.                if(int.TryParse(cell.Text, out personnelId))
    15.                {
    16.                    ApplicationStore.Instance.SelectedPersonnel = new Personnel(new PersonnelRecord(), personnelId);


    Could you please advise on what I should do to replace the missing DataSourcePersistenceMode property in order to retain the same functionality, and also could you please let me know if you have a guide on migrating from the .Net2 versions of the RadGrid and RadChart to the up to date releases since I'm guessing I'm going to find a lot of issues when I get to testing the chart control.






  2. Viktor Tachev
    Viktor Tachev avatar
    2501 posts

    Posted 18 May 2016 Link to this post

    Hi Jonathan,

    The version of the controls you are using is very outdated and the new controls are completely reworked. This is why the property you are referring to is not available in the current controls.

    If you would like to specify that the state of RadGrid should not be persisted you can use the EnableViewState property and set it to false.

    You can find additional information regarding ViewState optimization in the following article:

    Viktor Tachev
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top