Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
1.0K+ views

Hi, 
I have a radgrid which has custom filtering, sorting , paging and if I want to find the filter expression I go to

Radgrid.MasterTableView.FilterExpression.
The expression I get uses a lot of OR clause instead of having them in a IN clause.Ex. 
(([Column_One] = 'Cust ')) AND (([Column_Two] = '3/31/2016 12:00:00 AM') OR ([Column_Two] = '3/18/2016 12:00:00 AM') OR ([Column_Two] = '3/28/2016 12:00:00 AM'))
When I use the below code to manually filter the datatable 
Dim filteredRows As DataRow() = dataTable.Select(RadGrid1.MasterTableView.FilterExpression)
 I get stackoverflow error when I use the above filter expression for custom filtering as the number of columns and options can get huge. This https://blogs.msdn.microsoft.com/sqldev/2008/12/10/you-may-get-system-stackoverflowexception-in-your-asp-net-application-if-your-filter-condition-has-too-many-or-in-your-datatable-select-function/ article suggest that instead of having multiple OR clauses it should be reduced to IN clause to mitigate this problem. Is there a way to get the query in such a way so that I don't have to write one myself.

Also, Can you also tell me how the default filtering using onNeedDataSource works. I have a huge datatable( around 50k recods). When I tried debugging with default paging goes to the onNeedDataSource event and then filters the data. I am not sure if the dataTable is being fetched every single time. As the time taken for filtering is quite high.

I followed all the optimization techniques and got the paging to run quicker. But in the example for custom paging I see that Custom paging is being turned off when filtering or grouping  is applied. Like http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/functionality/paging/custom-paging . This again causes the filtering to run slower. 

Is this because the default filtering causes the page the fetch the entire data and then select the required columns from there.?

This the code as of Now. I am turning off the custom paging only for grouping. And it runs faster as I take the table from the Cache and not the Database.

Private isGrouping As Boolean = False
 
    Protected Sub RadGrid1_GroupsChanging(source As Object, e As GridGroupsChangingEventArgs)
        isGrouping = True
        If e.Action = GridGroupsChangingAction.Ungroup AndAlso RadGrid1.CurrentPageIndex > 0 Then
            isGrouping = False
        End If
    End Sub
 
    Public Function ShouldApplySortFilterOrGroup() As Boolean
        Return (RadGrid1.MasterTableView.GroupByExpressions.Count > 0 OrElse isGrouping) OrElse RadGrid1.MasterTableView.SortExpressions.Count > 0
    End Function
 
    Protected Function getDataTable() As DataTable
        Dim key As String = [String].Format("{0}/{1}/{2}/{3}/{4}", x, y, c, f, s)
        Dim dataTable As DataTable = TryCast(HttpRuntime.Cache(key), DataTable)
        If dataTable Is Nothing Then
            SqlDataSource1.FilterExpression = Session("as")
            SqlDataSource1.DataBind()
            Dim dv As DataView = DirectCast(SqlDataSource1.[Select](DataSourceSelectArguments.Empty), DataView)
            dataTable = dv.ToTable()
            Session(key) = dataTable
            HttpRuntime.Cache(key) = dataTable
        End If
        Return dataTable
    End Function
 
    Protected Sub RadGrid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        Dim dataTable As DataTable = getDataTable()
        If RadGrid1.MasterTableView.FilterExpression <> "" Then
            Dim filteredRows As DataRow() = dataTable.Select(RadGrid1.MasterTableView.FilterExpression) `StackOverFlow error occours here
            If filteredRows.Length > 0 Then
                dataTable = filteredRows.CopyToDataTable()
            End If
        End If
        Dim startRowIndex As Integer = If((ShouldApplySortFilterOrGroup()), 0, RadGrid1.CurrentPageIndex * RadGrid1.PageSize)
        Dim maximumRows As Integer = If((ShouldApplySortFilterOrGroup()), dataTable.Rows.Count, RadGrid1.PageSize)
        RadGrid1.AllowCustomPaging = Not ShouldApplySortFilterOrGroup()
        If RadGrid1.AllowCustomPaging Then
            RadGrid1.VirtualItemCount = dataTable.Rows.Count
        End If
        Dim rows As DataTable = dataTable.AsEnumerable().Skip(startRowIndex).Take(maximumRows).CopyToDataTable()
        RadGrid1.DataSource = rows
    End Sub

Any help would be great. Thanks!
Viktor Tachev
Telerik team
 answered on 30 Sep 2016
1 answer
129 views
Good evening, I'm using a RadPageLayout control.
The control is formed by two lines, the first has a RadToolBar.
The second row is divided into two columns, in the first column has a RadTreeView and in the second a RadGrid.

My question is, what is the best way to show the sandwich icon (to show the RadTreeView in mobile device) as in the case of your website?

I hope I was clear.

Thanks in advance
Magdalena
Telerik team
 answered on 30 Sep 2016
2 answers
190 views

Hello Telerik,

I'm using a pop up edit form in a Radgrid.  Is it possible to style (font size, color, etc) the Label associated with a given edit item in the code behind?  I have multiple edit fields on the form and I need to change the style of some of the labels. but not all of them.

Also, how can I prevent the colon(":") from being added to the end of my labels.

Thank you.

Ralf
Top achievements
Rank 1
 answered on 29 Sep 2016
18 answers
2.1K+ views
Is there a way to have only Horizontal Scrollbar in a radgrid? When I enable scrolling in ClientSettings, both Horizontal and Vertical scrollbar shows up. I want to have only Horizontal scrollbar and the height of the grid should adjust as per the number of records, which happens when you don't have scrolling enabled. I also tried using Scrollheight, in that case if the number of records are less than what can be shown in that height, there is whitespace for the rest of the height.

Thanks
bryan
Top achievements
Rank 1
 answered on 29 Sep 2016
1 answer
88 views

I want to customize the add new button, centering it on the grid but also having the same functionality as the normal built in Add New button.

Here is the code I have so far:

<CommandItemSettings ShowAddNewRecordButton="False" />
<CommandItemSettings ShowRefreshButton="false" />
<CommandItemTemplate>
    <div id="divCenter" style="text-align: center">
    <asp:LinkButton ID="btnAddNew" Text="Add New" CommandName="Insert" runat="server"></asp:LinkButton>
</div>
</CommandItemTemplate>

The problem is the Insert command only makes the screen flash and doesn't open the Add New dialog.

Can you help?

LJZIMMERMAN
Top achievements
Rank 1
 answered on 29 Sep 2016
0 answers
49 views

The R3 2016 release of the Telerik UI for ASP.NET AJAX suite introduces several improvements of the Lightweight rendering of the RadTreeView. As the RadDropDownTree uses an embedded RadTreeView for its drop-down, those changes apply for that control too.

Full description of the improvements made could be found in the following documentation article.

Telerik Admin
Top achievements
Rank 1
Iron
 asked on 29 Sep 2016
0 answers
64 views

The R3 2016 release of the Telerik UI for ASP.NET AJAX suite introduces several improvements of the Lightweight rendering of the RadTreeView.

Full description of the improvements made could be found in the following documentation article.

Telerik Admin
Top achievements
Rank 1
Iron
 asked on 29 Sep 2016
1 answer
270 views

Hi 

How can I prevent without losing the data of radasyncupload on post back. My requirement is that onFileUploaded I need to assign the count of number of uploaded files to repeater control(this is done on server side, so post back is happening here) and on click of upload in a repeater item, I need to transfer the file to some other location. But on button click I'm not able to retain radasyncupload data as I'm already doing one post back to assign data to repeater control. 

Thanks in advance

Vinod

 

Anton
Telerik team
 answered on 29 Sep 2016
3 answers
104 views
I know that many other people have posted threads about this issue; however, non of them got my issue resolved. Well, I'm trying to send the content of RadEditor , which contains images (uploaded to a folder on the web server) to as an email (using GMail), but when the email is received, the image is unavailable. ContentFilters is set to "MakeUrlsAbsolute, DefaultFilters", SearchPatterns is set to "*.jpeg,*.jpg,*.png,*.gif,*.bmp". I've gove "Everyone" access to the folder where images are uploaded but this has not fixed the issue. When I inspected the<img> tag in the received email, I found out that the URL has been changed to "https://ci4.googleusercontent.com/proxy/" and some random letters before the actual URL. I'm not sure why this is happening and whether this is a GMail issue or RadEditor issue. Nothing online helped me to get this issue resolved.
Rumen
Telerik team
 answered on 29 Sep 2016
2 answers
176 views

Hello,

 

Inside a RadScheduler (ID= "Radscheduler1")

I have a RadComboBox (ID="acbProjet") with an 'OnSelectedIndexChanged' Inside Advanced Insert Form.

I have also an other RadDropDownList (ID="RadDropDownListTypeHeure") depending on the choice of the RadComboBox.

        protected void acbProjet_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
          // ??? RadDropDownList rddl = (RadDropDownList) RadScheduler.FindControl("RadDropDownListTypeHeure");
          // ??? RadDropDownListTypeHeure = (RadComboBox)e.Container.FindControl("RadDropDownListTypeHeure");
        }

 

HOW can i access the RadDropDownList for update the datasource ?

THANK you for your HELP

 

 

Peter Milchev
Telerik team
 answered on 29 Sep 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?