Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
386 views

Hello,

I am going to start telerik controls into my projects and so first of all creating sample apps to become familiar with the controls.

For Radgrid, my requirement is as follows for the filters:

1. If I have a "GridDateTimeColumn" into my grid and I don't want to use <FilterTemplate> for the "From" and "To" date pickers. And I wanted the Between operator always for DateFilters and I added a Reset Filter button also to reset that Date filter. So, to achieve that I did some changes intoItemCreated event. Everything is working like a charm. The issue comes when user is trying to enter the same dates into From and To date pickers nd press <Tab> key, its not filtering the grid. I tried to debug the code and I found that the the FilterExpression of grid getting built like this:

(([ShippingDate] >= '2/3/2020,12:00:00,AM') AND ([ShippingDate] <= '2/3/2020,12:00:00,AM'))

Time is included here. So, can you please help me out for this issue.

2. How can I validate the filter for the column where I want to display the currency or a number value. It is right now allowing me to enter any text I want. It should allow me to enter digits and decimal only.

For the assistance, I am attaching a sample project here which can describe what I am trying to achieve.

Thanks in advance. Please look into these issues and try to assist me ASAP.

Regards,

Vertis Software

 

ASPX Page code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestFilters.aspx.cs" Inherits="RadGridFilters.TestFilters" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function ResetCurrentDateColumnFilter(dateFilterUniqueName, radgridClientID) {
                var masterTableView = $find(radgridClientID).get_masterTableView();
                masterTableView.filter(dateFilterUniqueName, "", Telerik.Web.UI.GridFilterFunction.NoFilter);
            }
        </script>
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="TestFilterScriptManager" />
        
        <telerik:RadAjaxLoadingPanel runat="server" ID="TestFilterRadAjaxLoadingPanel" />
        <telerik:RadAjaxManager ID="RadAjaxLoadingPanelRadAjaxManager" runat="server" DefaultLoadingPanelID="TestFilterRadAjaxLoadingPanel">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="TestFilterRadGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="TestFilterRadGrid" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        
        <table style="width: 900px; padding-left: 250px;">
            <tr>
                <td>
                    <telerik:RadGrid ID="TestFilterRadGrid" runat="server" Skin="Outlook" Width="600px"
                        GridLines="None" AllowSorting="true" AllowPaging="true" AllowFilteringByColumn="true" AutoGenerateColumns="false"
                        EnableLinqExpressions="false" OnNeedDataSource="TestFilterRadGrid_NeedDataSource" OnItemCreated="TestFilterRadGrid_ItemCreated">
                        <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />
                        <MasterTableView TableLayout="Fixed" CommandItemDisplay="None" Width="100%">
                            <Columns>
                                <telerik:GridBoundColumn UniqueName="ShippedToPerson" HeaderText="Shipped To" AutoPostBackOnFilter="true"
                                    DataField="ShippedToPerson" DataType="System.String" HeaderStyle-Width="150px" CurrentFilterFunction="Contains" />
                                <telerik:GridDateTimeColumn UniqueName="ShippingDate" HeaderText="Shipping Date" AutoPostBackOnFilter="true"
                                    DataField="ShippingDate" DataType="System.DateTime" HeaderStyle-Width="150px" CurrentFilterFunction="Between"
                                    PickerType="DatePicker" EnableRangeFiltering="true" ShowFilterIcon="false" />
                                <telerik:GridBoundColumn UniqueName="Amount" HeaderText="Amount" AutoPostBackOnFilter="true"
                                    DataField="Amount" DataType="System.Double" HeaderStyle-Width="150px" CurrentFilterFunction="EqualTo"
                                    DataFormatString="{0:C}" />
                            </Columns>
                            <CommandItemSettings ShowExportToWordButton="false" ShowExportToExcelButton="true"
                                ShowExportToCsvButton="false" ShowExportToPdfButton="false" />
                        </MasterTableView>
                        <GroupingSettings CaseSensitive="false" />
                    </telerik:RadGrid>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>

 

ASPX.CS Page code

public partial class TestFilters : Page
    {
        protected void TestFilterRadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            DataTable dataTable = new DataTable();
            dataTable.Columns.Add(new DataColumn("ShippedToPerson", typeof(string)));
            dataTable.Columns.Add(new DataColumn("ShippingDate", typeof(DateTime)));
            dataTable.Columns.Add(new DataColumn("Amount", typeof(double)));

            for (int index = 1; index <= 10; index++)
            {
                DataRow row = dataTable.NewRow();
                row["ShippedToPerson"] = string.Format("Person {0}", index);
                row["ShippingDate"] = DateTime.Now.AddDays(index);
                row["Amount"] = 1.4 * index;

                dataTable.Rows.Add(row);
            }

            TestFilterRadGrid.DataSource = dataTable;
        }

        protected void TestFilterRadGrid_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridFilteringItem)
            {
                GridFilteringItem filters = e.Item as GridFilteringItem;

                if (filters == null)
                    return;

                foreach (GridTableCell control in filters.Controls)
                {
                    if (control.Column.DataType == typeof(DateTime))
                    {
                        string dateFilterUniqueName = control.Column.UniqueName;
                        LiteralControl fromLiteralControl = filters[dateFilterUniqueName].Controls[0] as LiteralControl;

                        if (fromLiteralControl != null)
                            fromLiteralControl.Text = string.Format("<span style='padding-right: 2px; vertical-align: top;'>{0}:</span>", "From");

                        LiteralControl toLiteralControl = filters[dateFilterUniqueName].Controls[3] as LiteralControl;

                        if (toLiteralControl != null)
                            toLiteralControl.Text = string.Format("<br /><span style='padding-right: 18px; vertical-align: top;'>{0}:</span>", "To");

                        ImageButton clearCurrentDateFilterButton = new ImageButton();
                        clearCurrentDateFilterButton.ID = dateFilterUniqueName;
                        clearCurrentDateFilterButton.ImageUrl = "clearFilter.png";
                        clearCurrentDateFilterButton.ToolTip = "Reset Filter";
                        clearCurrentDateFilterButton.Attributes.Add("style", "width: 19px; vertical-align: top; padding-left: 2px;");
                        clearCurrentDateFilterButton.Attributes.Add("onclick", string.Format("javascript: ResetCurrentDateColumnFilter('{0}', '{1}'); return false;",
                            dateFilterUniqueName, TestFilterRadGrid.ClientID));
                        filters[dateFilterUniqueName].Controls.AddAt(6, clearCurrentDateFilterButton);
                    }
                }
            }
        }
    }

 

 

Attila Antal
Telerik team
 answered on 26 Mar 2020
4 answers
240 views
Im trying to get the pdf export feature to work but i cant.
Even on the demo you have here doesnt behave as it should;

I understand that the pdf export feature prints whats being seen at the moment, not the entire appointments list.
I im interested on the monthly view and on that view it works as if it were a printscreen. Ive attached the pdf im getting from your online demo. 

Im using both IE 10 and Chrome v 24.0.1312.52.

Another issue i have noted is that on monthview only a part of the Subject is shown; i have a custom scheduler where my template shows the users involved, the location it will take place,  the title, the description and the type of the event. How can i show that info on monthview and print it? (Please see here ) for screenshots

Sumit
Top achievements
Rank 1
 answered on 25 Mar 2020
15 answers
492 views
Hi there,

Ive bound successfully to my web service and am returning the required data using the following:

foreach (Site site in sites)
 {
                AutoCompleteBoxItemData childNode = new AutoCompleteBoxItemData();
                childNode.Text = site.PublicName;
                childNode.Value = site.SiteId.ToString();
                childNode.Attributes.Add("PublicUrl", site.PublicUrl);
                childNode.Attributes.Add("Description", site.Description);
                result.Add(childNode);
}

How do I access though attributes (PublicUrl etc) client side in my OnClientEntryAdded method:

function onEntryCalendarAdded(sender, eventArgs)
 {
                debugger;
                var controlEntry = eventArgs.get_entry();
                // gain access to public url etc here
}
Peter Milchev
Telerik team
 answered on 25 Mar 2020
2 answers
135 views

Dear Admin,

 

is there any way to change color of racRemoveToken (x) on RadAutocomplete ? Currently, i'm using css to force styling of racRemoveToke, which is :

.RadAutoCompleteBox_Default .racToken {
        border-color:white;
        background-color:white;
        background-image:linear-gradient(white,white);
    }
    .RadAutoCompleteBox .racRemoveTokenLink {
        color:red;
    }

 

it is working fine on Chrome, but when i'm opened in Internet Explorer, red color on racRemoveToken doesn't apply, file attached below.

 

 

Regard,

 

Ragil

Ragil
Top achievements
Rank 1
 answered on 25 Mar 2020
5 answers
243 views
Hi

I'm using two dock zones in a page and I have some controls in one of them, I'm trying to drag these controls into the other dock zone and have it in both zones, In common words I need to copy (or something like that) the control by dragging it on the other zone,

Any ideas how to do that?

Thanks
Vessy
Telerik team
 answered on 25 Mar 2020
1 answer
210 views

I am migrating a SharePoint 2013 system to SharePoint 2019 that uses Telerik AJAX heavily.  I have updated the Telerik dlls to the latest version (2020.1.219).  The issue I am encountering is whenever a telerik ajax request is made, the AjaxLoadingPanel appears, and then once the response comes back the opacity is set to 0 on the body element, which hides everything on the page.

This is the response I am retrieved from Chrome developer tools:

 

|1261|scriptStartupBlock|ScriptContentNoTags|Sys.Application.add_init(function() {<br>    $create(Telerik.Web.UI.RadAjaxManager, {"_updatePanels":"","ajaxSettings":[{InitControlID : "ctl00_PlaceHolderMain_HomeRightBox1_ctl00_RadBtnOk",UpdatedControls : [{ControlID:"ctl00_PlaceHolderMain_HomeRightBox1_ctl00_pnlRightBox",PanelID:"ctl00_RadAjaxLoadingPanel1"}]},{InitControlID : "ctl00_PlaceHolderMain_HomeRightBox1_ctl00_RadWindowWarning_C_lnkClose",UpdatedControls : [{ControlID:"ctl00_PlaceHolderMain_HomeRightBox1_ctl00_pnlRightBox",PanelID:"ctl00_RadAjaxLoadingPanel1"}]},{InitControlID : "ctl00_PlaceHolderMain_HomeRightBox1_ctl00_RadWindowWarning_C_cmdAgree",UpdatedControls : [{ControlID:"ctl00_PlaceHolderMain_HomeRightBox1_ctl00_pnlRightBox",PanelID:"ctl00_RadAjaxLoadingPanel1"}]}],"clientEvents":{OnRequestStart:"",OnResponseEnd:""},"defaultLoadingPanelID":"ctl00_RadAjaxLoadingPanel1","enableAJAX":true,"enableHistory":false,"links":["/_layouts/15/1033/styles/Themable/corev15.css?rev=4fiYiJfZqSkE1X%2BbH5YbUw%3D%3DTAG0","/_layouts/15/1033/styles/XYZ/main.css?rev=5Sa4i2FVc1HsIuLe3sZYGA%3D%3DTAG0","/_layouts/15/images/favicon.ico?rev=23"],"styles":["body {opacity:0 !important}"],"uniqueID":"ctl00$RadAjaxManager1","updatePanelsRenderMode":0}, null, null, $get("ctl00_RadAjaxManager1"));<br>});


The culprit is the "styles":["body {opacity:0 !important}"] portion.  Does anyone know why this would be happening?
Attila Antal
Telerik team
 answered on 24 Mar 2020
2 answers
277 views

Hello,

I need to select Tree list row by javascript.
So far I found this code:

function selectTask(tsk){
         var gantt = $find("<%= RadGantt1.ClientID%>");
         gantt._widget.select("tr:eq(" + tsk.get_id() + ")");
     }

 

But this does not work well. It works only in some cases, sometimes it selects the wrong row or nothing at all.
Can you help me?
Thank you.

Igor
Top achievements
Rank 1
 answered on 24 Mar 2020
2 answers
139 views

Using the Mega Drop down example.  

I dynamically created a site map; however, how do I get it to treat the long column as 2 short columns.  

 

|  Column 1 Headline       |                                                               Column   2   headline                                                  |

|          column 1 data        |            [Column 2  Right data]                     [  Column 2 Left data  ]                                       |

 

Keep in mind the data is loaded dynamically and can\will change depending on the user that is accessing the page.  

The one Idea I had was to nest a site map within a site map put I do not find a way to do that.  

 

Any ideas that would point me in the right direction would help.  

 

 

 

Vessy
Telerik team
 answered on 24 Mar 2020
3 answers
317 views

I am using Filter with Grid. If I set FieldName in the FieldEditors that is not in the Grid column (but from binded table), I get null reference exception after call RadFilter1.FireApplyCommand(). Is it Filter control limitation? If yes, is there work around?

 

Stack trace:

   at Telerik.Web.UI.RadFilterDataFieldEditor.CreateEditorFrom(RadFilterDataFieldEditor baseEditor)
   at Telerik.Web.UI.RadFilterSingleExpressionItem.SetupFunctionInterface(Control container)
   at Telerik.Web.UI.RadFilterExpressionItem.CreateFunctionalInterface()
   at Telerik.Web.UI.RadFilterExpressionItem.InitializeItem()
   at Telerik.Web.UI.RadFilter.CreateFilterItems()
   at Telerik.Web.UI.RadFilter.CreateControlHierarchy()
   at Telerik.Web.UI.RadFilter.CreateChildControls()
   at System.Web.UI.Control.EnsureChildControls()
   at Telerik.Web.UI.RadFilter.RecreateControl()
   at Telerik.Web.UI.RadFilter.ContainerFieldDescriptorsReady(Object sender, RadFilterFildDesciptorsEventArgs e)
   at Telerik.Web.UI.RadGrid.OnFieldDescriptorsReady(RadFilterFildDesciptorsEventArgs e)
   at Telerik.Web.UI.RadGrid.UpdateFilterControl()
   at Telerik.Web.UI.GridTableView.SavePagingData(Boolean useDataSource, GridPagingManager paging)
   at Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource)
   at Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource)
   at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
   at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
   at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
   at Telerik.Web.UI.GridTableView.PerformSelect()
   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
   at Telerik.Web.UI.GridTableView.DataBind()
   at Telerik.Web.UI.GridTableView.Rebind()
   at Telerik.Web.UI.RadGrid.Telerik.Web.UI.IRadFilterableContainer.ApplyFilterExpressions(RadFilterGroupExpression expressionRoot, Boolean shouldBind)
   at Telerik.Web.UI.RadFilter.HandleApplyCommand()
   at Telerik.Web.UI.RadFilter.FireApplyCommand()
   ...

Doncho
Telerik team
 answered on 23 Mar 2020
6 answers
324 views
I have a RadDataForm that is databound to a SQLDataSource.  If I use a RadTextBox within a Div within the EditTemplate, the value entered into that RadTextBox is sent to the database.  However, if I put that RadTextBox within a Table->TableRow->TableCell in the Div, the value entered into that RadTextBox is never sent to the database, nor is it still in the form after the update.  Are there restrictions on how controls can be embedded within the EditTemplates when editing data?
Doncho
Telerik team
 answered on 23 Mar 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?