Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
366 views

Good afternoon,

I am trying to connect a RadClientDataSource to a web Service but it is not getting called (I know because i am tracing the sql database that it uses and I have tried with breakpoints). At present the code is:

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPageSingleMenu.Master" AutoEventWireup="true" CodeFile="Grid.aspx.cs" Inherits="Grid" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="styles/grid.css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
       <telerik:RadGrid RenderMode="Lightweight" ID="dgSessions" runat="server" AutoGenerateColumns="false"  AllowSorting="true"
              EnableHeaderContextMenu="true"  ClientDataSourceID="RadClientDataSource1" 
          AllowMultiRowSelection="false"  >
           
            <MasterTableView Width="100%" ClientDataKeyNames="SessionKey" DataKeyNames="SessionKey" CommandItemDisplay="None">
                
                <Columns>
                
                    <telerik:GridBoundColumn UniqueName="HorseName" HeaderText="Horse" DataField="HorseName" ReadOnly="True">
                    </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="BT200" HeaderText="BT200" DataField="BT200" ReadOnly="True">
                    </telerik:GridBoundColumn>

                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    <telerik:RadClientDataSource ID="RadClientDataSource1" runat="server">
            <DataSource>
                <WebServiceDataSourceSettings ServiceType="OData" >
                    <Select Url="http://localhost:49833/ETSession.svc/GetSessions" DataType="JSON" />
                </WebServiceDataSourceSettings>
            </DataSource>
            <Schema>
                <Model ID="SessionKey">
                    <telerik:ClientDataSourceModelField FieldName="SessionKey" />
                    <telerik:ClientDataSourceModelField FieldName="HorseName" DataType="String" />
                    <telerik:ClientDataSourceModelField FieldName="BT200" />
                </Model>
            </Schema>
        </telerik:RadClientDataSource>
</asp:Content>

I have tried with a remote web service, also with the web service code file in the same project as the page, but to no avail.

I have also tried the follwing snippet:

<WebServiceDataSourceSettings ServiceType="OData" BaseUrl="http://localhost:49833/ETSession.svc/" >
                    <Select Url="GetSessions" DataType="JSON" />
                </WebServiceDataSourceSettings>

This results in GetSessions giving a Not Found indicator (green squigly line under the name) - that occurs in all three scenarios (remote, local or in-place).

The service works as i have tested it from another project.

Using VS2010 and .Net 4

 

Would welcome any thoughts.

Mary

Mary
Top achievements
Rank 1
 answered on 07 May 2018
0 answers
126 views

Hello,

I need to get the sortorder of the Grid in _NeedDataSource even and nowhere else. However the SortOrder value is always 'Ascending'. How do you get the updated sort order ? I have code below. Thank you.

 

protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
 
...
 
string name = RadGrid1.MasterTableView.SortExpressions[0].FieldName;
                    GridSortOrder order = RadGrid1.MasterTableView.SortExpressions[0].SortOrder;
 
 
}
Darius
Top achievements
Rank 1
 asked on 04 May 2018
3 answers
298 views

Hi All, i'm working on producing a dynamic pie chart that's linked to a Radgrid column and updates as the grid is being filtered  . 

 

I have a Radgrid with the following columns; 

application ids'

Application Status (only 3 status's "accepted/declined/in-progress")

Received date from

Revived date to 

BatchID

 

What i'm trying to achieve;

1) Piechart that's based on the application status column 

2) The Pie chart to recalculate when the applications are being filtered by Received date or batchID

 

Any advise or solutions will be much appreciated.

Marin Bratanov
Telerik team
 answered on 04 May 2018
12 answers
280 views
Hi,

i have a requirement to display grouped items in radlistbox like below

General Action
    Transfer
    Document
    Re-Open
Escalation
    Parts
    Field Involvement
Other Actions
    Marketing
    Owner Advantage

i have to load these items in runtime(server side) because based on some conditions i have to disable/enable listitems.Also i have to differentiate the group name and child by font and space like above.
1.Now i can able to disable items. But i am not able to insert space before the child items. please check the code below which i used to generate these items
2.For group items if i disable it , the foreground color gets changed to grey. which i want it in black color like above.


foreach (var group in CASEACTION_GROUPS)
            {
            RadListBoxItem groupListItem = new RadListBoxItem { Text = group, Enabled = false };
                groupListItem.Font.Bold = true;
                groupListItem.Font.Italic = true;
                groupListItem.ForeColor = Color.Black;
                listBoxCaseActions.Items.Add(groupListItem);
foreach (var caseActon in caseActions)
                {
                    var listItem = new RadListBoxItem { Text = caseActon.EntityName, Value = caseActon.ObjectTypeCode };
  
                    if (!caseActon.HasPrivileges)
                    {
                        listItem.Enabled = false;
                        listItem.Text = string.Concat(caseActon.EntityName, CASEACTION_NO_PRIVILEGES);
                    }
                    else if ((caseActon.ObjectTypeCode.Equals("10022") && !_caseStatus.ToLower().Equals(CASE_STATUS_PENDING_CLOSED))) //Close Case
                    {
                        listItem.Enabled = false;
                        listItem.Text = string.Concat(caseActon.EntityName, string.Format(CASEACTION_NOT_AVAILABLE, _caseStatus));
                    }
                    else if (caseActon.ObjectTypeCode.Equals("10051")) //Re-open Case
                    {
                        if (_caseStatus.ToLower().Equals(CASE_STATUS_CLOSED))
                        {
                            this._caseActionsBusinessComponent = _caseActionsBusinessComponent ?? new CaseActionsBusinessComponent();
                            var role = this._caseActionsBusinessComponent.GetUserSecurityRole();
                            if (CASEACTION_USER_ROLE.Where(r => role.ToLower().Contains(r)).Count() > 0)
                            {
                                listItem.Enabled = true;
                            }
                            else
                            {
                                listItem.Enabled = false;
                                listItem.Text = string.Concat(caseActon.EntityName, CASEACTION_NO_PRIVILEGES);
                            }
                        }
                        else
                        {
                            listItem.Enabled = false;
                            listItem.Text = string.Concat(caseActon.EntityName, string.Format(CASEACTION_NOT_AVAILABLE, _caseStatus));
                        }
                    }
  
                    listBoxCaseActions.Items.Add(listItem);
                }
            }

Am I missing something.Can anybody help me on this issue.

Thanks in advance
Jayaprakash Krishnan
Marin Bratanov
Telerik team
 answered on 04 May 2018
2 answers
99 views

What's causing the Telerik RadEditor to place the CSS "t-no-boxshadow t-no-flexbox t-ie t-ie7" on the HTML element of my page.  When it renders like this the styling of the toolbars is incorrect.

I'm running in IE11, but my page is derived from a in-house framework class rather than System.Web.UI.Page.  Something in the custom class seems to be triggering the RadEditor to place this CSS on the HTML element.

Jim
Top achievements
Rank 1
 answered on 03 May 2018
1 answer
124 views

I'm using a trial version to test if updating an old 2013 version of the RadEditor will fix a bug we're having. The update fixes the bug we had, but it's causing another one in Edge. When typing into the editor in Edge the first character typed after a newline is always ignored.

Marin Bratanov
Telerik team
 answered on 03 May 2018
0 answers
184 views

Hi telerik team:

I want to cancel editing on client side without running "OnCommand" event, because NeedDataSource rebind current grid data.

How can I acomplish that functionality?

Attached is the issue I'm seeing. How could I run "Cancel" editing grid on client side, outside "OnCommand" event?

 
                <telerik:RadGrid RenderMode="Lightweight" ID="grdPTOPlanItemRates" GridLines="None" runat="server" AllowAutomaticDeletes="false" OnNeedDataSource="grdPTOPlanItemRates_NeedDataSource"
                    AllowAutomaticInserts="false" PageSize="10" Skin="Outlook"
                    AllowAutomaticUpdates="false" AllowPaging="True"
                    AutoGenerateColumns="False">
                    <MasterTableView CommandItemDisplay="Top" DataKeyNames="PTOPlanItemRateId" ClientDataKeyNames="PTOPlanItemRateId" NoDetailRecordsText="No PTO Plan Item Rates Records to display"
                        NoMasterRecordsText="No PTO Plan Item rates records were found" CommandItemSettings-AddNewRecordText="Add New" CommandItemSettings-ShowSaveChangesButton="false" CommandItemSettings-ShowCancelChangesButton="false" CommandItemSettings-ShowRefreshButton="false"
                        HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
                        <BatchEditingSettings EditType="Row" />
                        <Columns>
                              <telerik:GridButtonColumn ConfirmText="Delete this row?" ConfirmDialogType="RadWindow"
                                ConfirmTitle="Delete" HeaderText="" HeaderStyle-Width="50px"
                                CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                            </telerik:GridButtonColumn>
                            <telerik:GridBoundColumn UniqueName="PTOPlanItemRateId" Visible="false" DataField="PTOPlanItemRateId"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Rate" HeaderStyle-Width="70px" HeaderText="Rate" SortExpression="Rate"
                                UniqueName="Rate">
                                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                    <RequiredFieldValidator ForeColor="Red" Text="*This field is required" Display="Dynamic">
                                    </RequiredFieldValidator>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="StartYear" HeaderStyle-Width="70px" HeaderText="Start Year" SortExpression="StartYear"
                                UniqueName="StartYear">
                                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                    <RequiredFieldValidator ForeColor="Red" Text="*This field is required" Display="Dynamic">
                                    </RequiredFieldValidator>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="EndYear" HeaderStyle-Width="70px" HeaderText="End Year" SortExpression="EndYear"
                                UniqueName="EndYear">
                                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                    <RequiredFieldValidator ForeColor="Red" Text="*This field is required" Display="Dynamic">
                                    </RequiredFieldValidator>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                          
                        </Columns>
                    </MasterTableView>
                    <ClientSettings AllowKeyboardNavigation="true">
                        <ClientEvents />

                    </ClientSettings>
                </telerik:RadGrid>

  <table width="100%" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <a href="#" onclick="javascript: SavePTOPlanItemRates();" class="button primary">Save</a>
                                 <a href="#" onclick="javascript: CancelChanges();" class="button primary">Cancel Changes</a>
                            </td>
                        </tr>
                    </table>

 

<script>

function OpenPTOPlanItemRates(payTypeId) {
    var exitFlag = false;
    currentPayTypeId = payTypeId;

    $.ajax({
        type: "POST",
        url: "ConfigurationHandler.ashx?w=getPTOPlanItemRates&PTOPlanId=" + currentPTOPlanId + "&PayTypeId=" + payTypeId,
        async: false,
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert('Error:' + textStatus);
            alert('Error:' + errorThrown);
        },
        success: function (data, textStatus, XMLHttpRequest) {
            if (data != 'undefined')
            {
                if (data.length > 0) {
                    if (data == "logout") {
                        exitFlag = true;
                    }
                    else {
                        $("#divPTOPlanItemRates").dialog({
                            autoOpen: true,
                            title: "Add/Edit PTO Plan Item Rates",
                            width: "600px",
                            modal: true
                        });
                        updateGridPTOPlanItemRates(data);
                    }
                }
                else {
                    //
                    alert("No data");
                }
            }
         
        }
    });

    if (exitFlag) {
        parent.location = "Login.aspx";
        return false;
    }   
}

function updateGridPTOPlanItemRates(data) {
    //var data = [{ "ID": "1", "Rate": "1", "StartYear": "1998", "EndYear": "1999" }, { "ID": "2", "Rate": "2", "StartYear": "2005", "EndYear": "20018" }];
    var masterTableView = $find("<%= grdPTOPlanItemRates.ClientID %>").get_masterTableView();
    if (data != null) {
        var list = JSON.parse(data);
        masterTableView.set_dataSource(list.PTOPlanItemRatesList);
        masterTableView.dataBind();
    }
    else {
        //rebind with no data
        masterTableView.set_dataSource([]);
        masterTableView.dataBind();
    }
}


        function CancelChanges()
        {
            OpenPTOPlanItemRates(currentPayTypeId);
        }

    function SavePTOPlanItemRates()
    {
          var grid = $find('<%=grdPTOPlanItemRates.ClientID%>');
            var masterView = grid.get_masterTableView();
            var jsonArr = [];
            var row = null;
            var recordsCount = masterView.get_dataItems().length;
            for (var i = 0; i < recordsCount; i++) {
                row = masterView.get_dataItems()[i];
                jsonArr.push({
                    rate: row.get_cell('Rate').innerText,
                    startYear: row.get_cell('StartYear').innerText,
                    endYear: row.get_cell('EndYear').innerText,

                });
            }
            SavePTOIRChangesAjaxCall(jsonArr, recordsCount);
    }

    function SavePTOIRChangesAjaxCall(oData, recordsCount)
    {
        var exitFlag = false;
        var saved = false;

            $.ajax({
                type: "POST",
                url: "ConfigurationHandler.ashx?w=SavePTOItemRates&PTOPlanId=" + currentPTOPlanId + "&PayTypeId=" + currentPayTypeId + "&RecordsCount=" + recordsCount,
                async: false,
                data: "data=" + JSON.stringify(oData),
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert('' + textStatus);
                    alert('' + errorThrown);
                },
                success: function (data, textStatus, XMLHttpRequest) {
                    //$("#status img").hide();
                    if (data.length > 0) {
                        if (data == "logout") {
                            exitFlag = true;
                        }
                        else {
                               saved = true;
                        }
                    }                   
                }
            });
            
            if (exitFlag) {
                parent.location = "Login.aspx";
                return false;
            }

            if (saved)
            {
                alert('PTO Plan Item Rates were succesfully saved.');
            }
    }
</script>

 

 

Diego
Top achievements
Rank 1
 asked on 02 May 2018
3 answers
330 views

Hi,

I need to have a dialog pop up after a custom button is clicked to gather further information for the insertion of the element.

For example, I need to have a click on the (custom) insert radio-button pop up a dialog asking the name and the text for the radio button and then insert the radio button with the collected information.

Is there any way to do this?

Jim
Top achievements
Rank 1
 answered on 02 May 2018
4 answers
220 views
Hi,

I am using Telerik RadAsyncUpload and trying to get the keyboard control using the demo URL. I am using 2011.2.915.40 version.

http://demos.telerik.com/aspnet-ajax/asyncupload/examples/keyboardsupport/defaultcs.aspx

I am using the same code given in the demo URL, but unable to get the focus on Select button on Tab key. Please suggest me what I am missing in the attached code.

Thanks!
Abhinav
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FileAttachmentTest.aspx.cs" Inherits="FileAttachmentTest" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdatePanelsRenderMode="Inline">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadMaskedTextBox1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadAsyncUpload1" />
                    <telerik:AjaxUpdatedControl ControlID="RadMaskedTextBox1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <div>
        <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" OnClientAdded="keyboardSupport"
            AccessKey="P" OnClientFileUploading="onClientFileUploading" DisablePlugins="true">
        </telerik:RadAsyncUpload>
    </div>
 
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            debugger
            var $ = $telerik.$;
            var $cancelButton;
 
            // keyboardSupport() method activates focusing with TAB key
            function keyboardSupport(sender, args) {
                var $fileInput = $(".ruFileInput", args.get_row());
                $fileInput.attr("tabindex", "1")
 
                var $selectButton = $(".ruButton.ruBrowse", args.get_row());
 
                $fileInput.focus(function (e) {
                    $selectButton.css("border", "1px dotted");
                });
 
                $fileInput.blur(function (e) {
                    $selectButton.css("border", "0px");
                });
 
                if ($telerik.isIE) {
                    $fileInput.keydown(function (e) {
                        if (e.keyCode == Sys.UI.Key.tab && e.shiftKey == false) {
                            $fileInput.parent().focus();
                        }
                        if (e.keyCode == Sys.UI.Key.tab && e.shiftKey == true) {
                            e.preventDefault();
                            if ($cancelButton != undefined)
                                $cancelButton.focus();
                            else
                                $fileInput.parent().focus();
                        }
                    });
                }
            }
 
            function onClientFileUploading(sender, args) {
                $(".ruFileInput", args.get_row()).attr("tabindex", "-1");
 
                $cancelButton = $(".ruCancel", args.get_row());
                $cancelButton.attr("tabindex", "1");
            }
 
            $(document).keydown(function (e) {
                var accesskey = $find("<%=RadAsyncUpload1.ClientID%>")._accessKey;
 
                if ($telerik.isFirefox) {
                    if (e.altKey == true && e.shiftKey == true && e.which == accesskey.charCodeAt()) {
                        focusOnFirstInput();
                    }
                }
 
                if ($telerik.isChrome || $telerik.isSafari || $telerik.isIE) {
                    if (e.altKey == true && e.which == accesskey.charCodeAt()) {
                        focusOnFirstInput();
                    }
                }
            });
 
            function focusOnFirstInput() {
                var firstInput = $("input[type='file']", $get("<%=RadAsyncUpload1.ClientID%>"))[0];
                if (firstInput != undefined) {
                    firstInput.focus();
                }
            }
        </script>
    </telerik:RadCodeBlock>
    </form>
</body>
</html>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class FileAttachmentTest : ETOPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
}
jumhoye
Top achievements
Rank 1
 answered on 02 May 2018
0 answers
104 views

Hello Telerik Team,

It appears that if content has been inserted into the editor, when it is cut it is not copied to clipboard, it is just deleted. This behaviour can be reproduced in your track changes demo by typing some content, highlighting it and hitting ctrl + x. Upon trying to paste, the cut content is not pasted.

Is this a known bug, or is there any temporary fix you can provide.

 

looking forward to hearing back from you,

Aidan Harris

Aidan
Top achievements
Rank 1
 asked on 01 May 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?