This is a migrated thread and some comments may be shown as answers.

Items sort order not persisting after filtering

12 Answers 125 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Padmasinh
Top achievements
Rank 1
Padmasinh asked on 07 Mar 2014, 11:10 AM
My grid contains items in sort order as per my custom logic.But when i am using filter option with contains property, my grid shows the items which are perfectly match at the top and then other items.

So my sort order concept not persisting so longer.

I want filtering without changing the order of items in grid.

Thanks in advance!

12 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Mar 2014, 03:48 AM
Hi Padmasinh,

Please make sure that you are binding the RadGrid using Advanced Data-binding (using NeedDataSource event). It handles all the complex operation such as Inserting, deleting, and updating records through custom edit forms (WebUserControl or FormTemplate),Grouping, Hierarchy relations, Filtering, Sorting and Paging.
Hope this helps, else provide your code snippet.

Thanks,
Princy
0
Padmasinh
Top achievements
Rank 1
answered on 10 Mar 2014, 07:02 AM
Thank Princy for your reply.

But I am binding the RadGrid using Advanced Data-binding (using NeedDataSource event) then also

Items sort order not persisting after filtering.
0
Princy
Top achievements
Rank 2
answered on 11 Mar 2014, 03:40 AM
Hi Padmasinh,

Please take a look at the sample code snippet that I tried. Provide your full code snippet if this doesn't help.

ASPX:
<telerik:RadGrid ID="RadGrid1" AllowPaging="True" PageSize="15" runat="server" AllowFilteringByColumn="true" AllowSorting="true" OnNeedDataSource="RadGrid1_NeedDataSource" AutoGenerateColumns="false" GridLines="None">
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn UniqueName="OrderID" DataField="OrderID" HeaderText="OrderID" />
            <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" UniqueName="ShipCity" />
            <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" UniqueName="CustomerID" />
            <telerik:GridTemplateColumn DataField="ShipCountry" UniqueName="ShipCountry" HeaderText="ShipCountry" AllowFiltering="true" SortExpression="ShipCountry">
                <ItemTemplate>
                    <%# Eval("ShipCountry") %>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    RadGrid1.DataSource = GetDataTable("SELECT * FROM Orders");
}
public DataTable GetDataTable(string query)
{
    String ConnString = ConfigurationManager.ConnectionStrings["Northwind_newConnectionString3"].ConnectionString;
    SqlConnection conn = new SqlConnection(ConnString);
    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand(query, conn);
    DataTable myDataTable = new DataTable();
    conn.Open();
    try
    {
        adapter.Fill(myDataTable);
    }
    finally
    {
        conn.Close();
    }
    return myDataTable;
}

Thanks,
Princy
0
Padmasinh
Top achievements
Rank 1
answered on 28 May 2014, 07:47 AM
Hi Princy
My Sort order of records is persisting in normal radgrid but when i am using radgrid with grouping its not persisting.

The ragGrid during page load are as folllows.

Customer group Name        Customer Name      Sort Order
Group 1
                                              Very High                    1
                                                High                          2
                                               ABC                           3

and the filer for columns format are as follow

<telerik:GridBoundColumn HeaderText="Customer Name" FilterControlAltText="Filter column1 column"
                                    DataField="Name" UniqueName="Name" FilterControlWidth="150px" AutoPostBackOnFilter="true"
                                    HtmlEncode="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                                </telerik:GridBoundColumn>

And when i filter the grid on customer name with "high" word the grid shows results as follow

Customer group Name        Customer Name      Sort Order
Group 1
                                                  High                        2
                                              Very  High                   1
                                               
And i am needdatasource event then also this problem occurring so please provide me any solution.

Thanks
Padmasinh
0
Princy
Top achievements
Rank 2
answered on 28 May 2014, 09:07 AM
Hi Padmasinh,

I was not able to replicate such an issue at my end. Please take a look at the sample code snippet and attached screenshots of before and after filtering.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" AllowPaging="true" OnNeedDataSource="RadGrid1_NeedDataSource" AllowFilteringByColumn="true">
    <MasterTableView>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField FieldName="Group" HeaderText="Group" />
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="Group" SortOrder="Ascending" />
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <Columns>
            <telerik:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID" />
            <telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name" />
            <telerik:GridBoundColumn DataField="Group" HeaderText="Group" UniqueName="Group" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
  dynamic data = new[] {
  new { ID = 1, Name = "Very High", Group=1},
  new { ID = 2, Name = "High", Group=2},
  new { ID = 3, Name = "High", Group=1},
  new { ID = 4, Name = "Very High", Group=2},
  new { ID = 5, Name = "Low", Group=1},
  new { ID = 6, Name = "Very High", Group=1},
  new { ID = 7, Name = "Low", Group=2},
  new { ID = 8, Name = "Low", Group=3},
  new { ID = 9, Name = "Very High", Group=3}
};
    RadGrid1.DataSource = data;
}

Thanks,
Princy
0
Padmasinh
Top achievements
Rank 1
answered on 28 May 2014, 09:57 AM
Hi Princy,
Please check with my code :
ASPX Page :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Sort.aspx.cs" Inherits="LoadingPanel.Sort" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <telerik:RadScriptManager ID="mag" runat="server"></telerik:RadScriptManager>
            <div style="width: 100%;">
                <telerik:RadGrid ID="grd_view" runat="server"  GridLines="None"
                    AutoGenerateColumns="false" AllowPaging="True" PageSize="50" AllowSorting="True"
                    ShowStatusBar="true" AllowAutomaticInserts="false" AllowMultiRowSelection="True" AllowFilteringByColumn="true"
                    HorizontalAlign="NotSet" GroupingEnabled="true" ShowGroupPanel="false" OnNeedDataSource="grd_view_NeedDataSource"
                    EnableLinqExpressions="false">
                    <GroupingSettings GroupContinuedFormatString="" GroupContinuesFormatString="" GroupSplitDisplayFormat="" CaseSensitive="false"
                        GroupSplitFormat="{0}" />
                    <ClientSettings AllowExpandCollapse="True" AllowDragToGroup="False" AllowColumnsReorder="False">
                        <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="True" />
                        <Resizing AllowColumnResize="true" ResizeGridOnColumnResize="true" />
                        
                    </ClientSettings>
                    <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="Id" EditMode="PopUp">
                        <CommandItemSettings ExportToPdfText="Export to PDF" ShowAddNewRecordButton="false"
                            ShowRefreshButton="false"></CommandItemSettings>
                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        </ExpandCollapseColumn>
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldName="Group" HeaderText="Group" />
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="Group" SortOrder="Ascending" />
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <Columns>
                            <telerik:GridClientSelectColumn UniqueName="d" Groupable="false">
                            </telerik:GridClientSelectColumn>
                            <telerik:GridBoundColumn DataField="Id" FilterControlAltText="Filter column column"
                                HeaderText="Id" UniqueName="Id" Visible="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn HeaderText="Name" FilterControlWidth="300px" AutoPostBackOnFilter="true"
                                CurrentFilterFunction="Contains" ShowFilterIcon="false" DataField="Name" UniqueName="Name"
                                FilterControlAltText="Filter column1 column">
                                <ItemTemplate>
                                    <asp:Label ID="lbl_Id" Visible="false" runat="server" Text='<%#Eval("Id") %>'></asp:Label>
                                    <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Edit123" Text='<%# HttpUtility.HtmlEncode(Eval("Name")) %>'></asp:LinkButton>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn HeaderText="Mobile" FilterControlAltText="Filter column1 column"
                                HtmlEncode="true" DataField="Mobile" UniqueName="Mobile" FilterControlWidth="50px"
                                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                                SortExpression="Mobile">
                                <HeaderStyle Width="100px" />
                            </telerik:GridBoundColumn>
                        </Columns>
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                    <FilterMenu EnableImageSprites="False">
                    </FilterMenu>                    
                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                    </HeaderContextMenu>
                </telerik:RadGrid>
            </div>
    </div>
    </form>
</body>
</html>

CS Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data;

namespace LoadingPanel
{
    public partial class Sort : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                gridbind();
            }
        }
        void gridbind()
        {
            try
            {

                grd_view.Visible = true;

                grd_view.DataSource = GetStudents();
                grd_view.DataBind();
            }
            catch (Exception ex)
            {
            }
        }

        public List<Student> GetStudents()
        {
            List<Student> lstStudents = new List<Student>();

            for (int i = 0; i < 25; i++)
            {
                Student stud = new Student { Id = i, Name = "Very High" + i, Mobile = i.ToString(), Group = "Group 1" };
                lstStudents.Add(stud);
            }
            for (int i = 0; i < 25; i++)
            {
                Student stud = new Student { Id = i, Name = "High" + i, Mobile = i.ToString(), Group = "Group 1" };
                lstStudents.Add(stud);
            }

            return lstStudents;
        }

        protected void grd_view_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            try
            {

                grd_view.Visible = true;

                grd_view.DataSource = GetStudents();
            }
            catch (Exception ex)
            {
            }
        }

        static DataTable ConvertListToDataTable(List<Student> list)
        {
            DataTable table = new DataTable();

            table.Columns.Add("Id", Type.GetType("System.Int16"));
            table.Columns.Add("Name");
            table.Columns.Add("Mobile");

            foreach (var Student in list)
            {
                DataRow dr = table.NewRow();

                dr["Id"] = Student.Id.ToString();
                dr["Name"] = Student.Name;
                dr["Mobile"] = Student.Mobile;

                table.Rows.Add(dr);
            }

            return table;
        }

        protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            DataTable table = new DataTable();
            table.Columns.Add("ID", typeof(int));
            table.Columns.Add("FirstName", typeof(string));
            table.Columns.Add("LastName", typeof(string));
            for (int i = 0; i < 5; i++)
            {
                table.Rows.Add(i, "FirstName" + i, "LastName" + i);
            }

            (sender as RadGrid).DataSource = table;
        }
    }
}


Please provide me solution


0
Accepted
Princy
Top achievements
Rank 2
answered on 29 May 2014, 08:45 AM
Hi Padmasinh,

Please make sure that you bind the grid only in OnNeedDataSource event, you donot have to bind in pageload. I was able to replicate the issue, Its caused by setting EnableLinqExpressions="false", please set the property to true and check.

Thanks,
Princy
0
Padmasinh
Top achievements
Rank 1
answered on 29 May 2014, 01:29 PM
Thanks Princy for your reply its working.

But if i set EnableLinqExpressions="true" my grouping is not working and if set false grouping is working fine.
if i set this property to true last two group levels are coming to null {0}.
Please check my code:
Aspx Code :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="linexp.aspx.cs" Inherits="LoadingPanel.linexp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
     <form id="form1" runat="server">
    <div>
    <telerik:RadScriptManager ID="mag" runat="server"></telerik:RadScriptManager>
            <div style="width: 100%;">
                 <telerik:RadGrid ID="grd_view" runat="server" CssClass="RadGrid" GridLines="None"
                    AllowPaging="True" AllowSorting="True" ShowStatusBar="True"
                    AllowMultiRowSelection="True"
                    EnableLinqExpressions="true"  
                    OnNeedDataSource="grd_view_On_NeedDatasource" AutoGenerateColumns="False"
                     CellSpacing="0">
                    <GroupingSettings CaseSensitive="false" GroupContinuedFormatString="" GroupContinuesFormatString="" GroupSplitDisplayFormat=""
                        GroupSplitFormat="{0}" />
                    <ClientSettings AllowExpandCollapse="True">
                        <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="True" />
                        <Resizing AllowColumnResize="true" />
                       <%-- <ClientEvents OnGridCreated="Grid" />--%>
                    </ClientSettings>
                    <MasterTableView CommandItemDisplay="None" DataKeyNames="Id" EditMode="PopUp">
                        <CommandItemSettings ExportToPdfText="Export to PDF" ShowAddNewRecordButton="false"
                            ShowRefreshButton="false"></CommandItemSettings>
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn Resizable="true" FilterControlAltText="Filter ExpandColumn column">
                        </ExpandCollapseColumn>
                      
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldName="szFacilityName" Aggregate="Count" FieldAlias="szFacilityNameCount" />
                                    <telerik:GridGroupByField Aggregate="First" FieldName="szFacilityName" FieldAlias="szFacilityNameName" />
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="szFacilityName" />
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldName="Year1" Aggregate="Count" FieldAlias="Year1Count" />
                                    <telerik:GridGroupByField Aggregate="First" FieldName="Year1" FieldAlias="Year1Name" />
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="Year1" SortOrder="Descending" />
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldName="AnalysisCauseSortOrder" Aggregate="Count" FieldAlias="AnalysisCauseSortOrderCount" />
                                    <telerik:GridGroupByField Aggregate="First" FieldName="AnalysisCauseSortOrder" FieldAlias="AnalysisCauseSortOrderName" />
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="AnalysisCauseSortOrder" />
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldName="szAnalysis_CauseName" Aggregate="Count" FieldAlias="szAnalysis_CauseNameCount" />
                                    <telerik:GridGroupByField Aggregate="First" FieldName="szAnalysis_CauseName" FieldAlias="szAnalysis_CauseNameName" />
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="szAnalysis_CauseName" />
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldName="CauseSortOrder" Aggregate="Count" FieldAlias="CauseSortOrderCount" />
                                    <telerik:GridGroupByField Aggregate="First" FieldName="CauseSortOrder" FieldAlias="CauseSortOrderName" />
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="CauseSortOrder" />
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldName="szCauseName" Aggregate="Count" FieldAlias="szCauseNameCount" />
                                    <telerik:GridGroupByField Aggregate="First" FieldName="szCauseName" FieldAlias="szCauseNameName" />
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="szCauseName" />
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <Columns>
                        
                            <telerik:GridClientSelectColumn UniqueName="d" Groupable="false">
                            </telerik:GridClientSelectColumn>
                            <telerik:GridBoundColumn DataField="Id" FilterControlAltText="Filter column column"
                                HeaderText="Id" UniqueName="Id" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Actual Date" FilterControlAltText="Filter column1 column" HtmlEncode="true"
                                DataField="dtOccurDatetime" UniqueName="dtOccurDatetime" FilterControlWidth="180px"
                                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Equipment Small Category" FilterControlAltText="Filter column1 column" HtmlEncode="true"
                                DataField="nEquipmentSmallName" UniqueName="nEquipmentSmallName" FilterControlWidth="180px"
                                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn HeaderText="Equipment Name" FilterControlAltText="Filter column1 column"
                                DataField="EquipmentName" UniqueName="EquipmentName" FilterControlWidth="180px"
                                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                                <ItemTemplate>
                                    <asp:Label ID="lbl_Id" Visible="false" runat="server" Text='<%#Eval("Id") %>'></asp:Label>
                                    <asp:LinkButton ID="lnkEquipmentName" Style="color: Blue;" CommandName="EditRecord"
                                        runat="server" Text='<%#HttpUtility.HtmlEncode(Eval("EquipmentName")) %>'></asp:LinkButton>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn HeaderText="Component Name" FilterControlAltText="Filter column1 column" HtmlEncode="true"
                                DataField="szComponentName" UniqueName="szComponentName" FilterControlWidth="180px"
                                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                            </telerik:GridBoundColumn>
                            <%-- Coloumns For Filter Groping (Change) --%>
                            <telerik:GridBoundColumn HeaderText="szFacilityName" FilterControlAltText="Filter column1 column" HtmlEncode="true"
                                DataField="szFacilityName" UniqueName="szFacilityName" FilterControlWidth="180px"
                                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                                ItemStyle-Wrap="false">
                                <ItemStyle Wrap="false" />
                                <HeaderStyle Wrap="false" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Year1" FilterControlAltText="Filter column1 column" HtmlEncode="true"
                                DataField="Year1" UniqueName="Year1" FilterControlWidth="180px" AutoPostBackOnFilter="true"
                                CurrentFilterFunction="Contains" ShowFilterIcon="false" ItemStyle-Wrap="false">
                                <ItemStyle Wrap="false" />
                                <HeaderStyle Wrap="false" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="szAnalysis_CauseName" FilterControlAltText="Filter column1 column"
                                DataField="szAnalysis_CauseName" UniqueName="szAnalysis_CauseName" FilterControlWidth="180px"
                                AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                                ItemStyle-Wrap="false">
                                <ItemStyle Wrap="false" />
                                <HeaderStyle Wrap="false" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="szCauseName" FilterControlAltText="Filter column1 column" HtmlEncode="true"
                                DataField="szCauseName" UniqueName="szCauseName" FilterControlWidth="180px" AutoPostBackOnFilter="true"
                                CurrentFilterFunction="Contains" ShowFilterIcon="false" ItemStyle-Wrap="false">
                                <ItemStyle Wrap="false" />
                                <HeaderStyle Wrap="false" />
                            </telerik:GridBoundColumn>
                            <%-- Coloumns For Filter Groping --%>
                        </Columns>
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                    <FilterMenu EnableImageSprites="False">
                    </FilterMenu>
                    <HeaderStyle Width="130px" />
                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                    </HeaderContextMenu>
                </telerik:RadGrid>
            </div>
    </div>
    </form>
</body>
</html>


CS Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data;

namespace LoadingPanel
{
    public partial class linexp : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                grd_view.MasterTableView.GetColumn("d").HeaderStyle.Width = 0;
               
            }
        }

        protected void grd_view_On_NeedDatasource(object sender, GridNeedDataSourceEventArgs e)
        {
           
            try
            {
                DataTable dtMRAccAnalysisCause = new DataTable();
                dtMRAccAnalysisCause.Columns.Add("Id");
                dtMRAccAnalysisCause.Columns.Add("YEAR1", typeof(int));
                dtMRAccAnalysisCause.Columns.Add("szAnalysis_CauseName");
                dtMRAccAnalysisCause.Columns.Add("szCauseName");
                dtMRAccAnalysisCause.Columns.Add("dtOccurDatetime");
                dtMRAccAnalysisCause.Columns.Add("nEquipmentSmallName");
                dtMRAccAnalysisCause.Columns.Add("EquipmentName");
                dtMRAccAnalysisCause.Columns.Add("szComponentName");
                dtMRAccAnalysisCause.Columns.Add("szFacilityName");
                dtMRAccAnalysisCause.Columns.Add("AnalysisCauseSortOrder", typeof(int));
                dtMRAccAnalysisCause.Columns.Add("CauseSortOrder", typeof(int));
               
                DataRow dr = dtMRAccAnalysisCause.NewRow();

                dr["Id"] = "907";
                dr["dtOccurDatetime"] = "4/3/2012";
                dr["EquipmentName"] = "rrr";
                dr["szFacilityName"] = "Facility_1";
                dr["AnalysisCauseSortOrder"] = "1000001";
                dr["CauseSortOrder"] = "1000001";       
                dr["szAnalysis_CauseName"] = "N/A";  
                dr["szCauseName"] = " N/A ";
                dr["nEquipmentSmallName"] = "es1";
                dr["szComponentName"] = "";
                dr["YEAR1"] = "2012";
                       
                dtMRAccAnalysisCause.Rows.Add(dr);
               
                grd_view.DataSource = dtMRAccAnalysisCause;

            }
            catch (Exception ex)
            {
               
            }
        }
    }
}
0
Accepted
Angel Petrov
Telerik team
answered on 02 Jun 2014, 05:49 AM
Hi Padmasinh,

It seems that the problem is related to both enabling the LINQ expressions and the data itself. When testing the provided code locally I noticed that if the szCauseName cell value dose not contain a space at the end of the string the problem is not reproducible.

I have already logged this problem into our system and our developers will have the care to provide a fix for it as soon as possible. You can monitor our progress on the matter from this link. As a temporary workaround I would recommend setting the EnableLinqExpressions property to false.

Finally, I want to thank you for reporting this problem to us. As a token of gratitude for this I have updated your Telerik points.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Padmasinh
Top achievements
Rank 1
answered on 02 Jun 2014, 08:59 AM
Hi Angel,

Thanks for your reply.
0
Padmasinh
Top achievements
Rank 1
answered on 02 Jun 2014, 09:08 AM
Hi Angel,

I have checked my code. And i remove the end space in szCauseName Cell. But then also grouping is coming null at "CauseSortOrderName: {0}" please tell me where is a mistake in my code.
0
Angel Petrov
Telerik team
answered on 05 Jun 2014, 07:08 AM
Hello Padmasinh,

I was not able to reproduce the described behavior on my side. Could you please examine the attached website and tell us what differs in your case?

Additionally I would recommend waiting until our developers provide a fix for the problem. For the time being you can set the EnableLinqExpressions to false thus avoiding any group text format issues.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Padmasinh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Padmasinh
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or