Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
242 views
I am trying to use the ClientEvent OnCommand to develop custom client-side sorting based on the data type of the column being sorted.  How do I actually accomplish this?  Firing sender.get_masterTableView().sort(mysortexpression); causes an endless loop since the OnCommand event is fired.  Here is my code

function

 

SORT(sender, args) {

 

args.set_cancel(

true); //cancels postback

 

 

if (args.get_commandName() == "Sort") {

 

var

 

sortexp = new Telerik.Web.UI.GridSortExpression();

 

sortexp.set_fieldName(args.get_commandArgument());

sortexp.set_sortOrder(2);

 

 

sender.get_masterTableView().sort(sortexp

);//this causes an endless loop

 

 

}

Thanks

 

agasthya
Top achievements
Rank 1
 answered on 21 Feb 2018
3 answers
180 views

I have a page that I am trying to place two grids and set the heights or grid correctly correctly. I am making some success, see attached screen shot. I have the top grid loading somewhat visually correct but when I select a row in the grid (see second attached screen shot) it all falls part.

here is my page 

<%@ Page Title="" Language="C#" MasterPageFile="~/Modules/Module.Master" AutoEventWireup="true" CodeBehind="ManageEmployees.aspx.cs" Inherits="HelmOnline.Web.Modules.TimeClock.ManageEmployee" %>

<%@ Register Src="~/Common/Controls/CustomerIdField.ascx" TagPrefix="uc1" TagName="CustomerIdField" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ModuleContent" runat="server">
    <div style="margin: 10px; height: 100%; background-color: pink;">

        <style type="text/css">
            .rightAlign {
                float: right;
            }
        </style>

        <telerik:RadScriptBlock runat="server">
            <script type="text/javascript">
                function Resize() {
                    setTimeout(function () {
                        var scrollArea = document.getElementById("<%= RadGrid1.ClientID %>" + "_GridData");
                if (scrollArea) {
                    //scrollArea.style.height = 100%;
                    alert(document.body.offsetHeight);
                    scrollArea.style.height = ((document.body.offsetHeight) / 2) - 150 + "px";
                }

                if (window["<%= RadGrid1.ClientID %>"].ClientSettings.Scrolling.UseStaticHeaders) {
                    var header = document.getElementById("<%= RadGrid1.ClientID %>" + "_GridHeader");
                    scrollArea.style.height = document.body.offsetHeight - header.offsetHeight + "px";
                }
                    }, 200);
                }
                window.onresize = window.onload = Resize;

                function OpenWCEntry(sender, punchid, customerid, employeeid, punchtimein, punchtimeout) {
                    //alert('Hello');
                    var dialogWindow = $find("<%=RadWindow1.ClientID%>");
                    dialogWindow.set_title("Modify Punch Entry");
                    //dialogWindow.set_navigateUrl(dialogWindow._navigateUrl);
                    var baseUrl = "Dialog/AddEditWebTime.aspx";
                    baseUrl = baseUrl + "?";
                    baseUrl = baseUrl + "punchid=" + punchid;
                    baseUrl = baseUrl + "&";
                    baseUrl = baseUrl + "customerid=" + customerid;
                    baseUrl = baseUrl + "&";
                    baseUrl = baseUrl + "employeeid=" + employeeid;
                    baseUrl = baseUrl + "&";
                    baseUrl = baseUrl + "punchtimein=" + punchtimein;
                    baseUrl = baseUrl + "&";
                    baseUrl = baseUrl + "punchtimeout=" + punchtimeout;
                    dialogWindow.set_navigateUrl(baseUrl)
                    dialogWindow.set_modal(true);
                    dialogWindow.show();
                }

                function OnClientCloseHandler(sender, args) {
                    var btnRefreshGrids = $find("<%=btnRefreshGrids.ClientID%>");
                    btnRefreshGrids.click();
                }

                function OpenWebClockReport(sender, customerid, startdate, enddate) {

                    var baseUrl = "Dialog/WebClockReport.aspx";
                    baseUrl = baseUrl + "?";
                    baseUrl = baseUrl + "customerid=" + customerid;
                    baseUrl = baseUrl + "&";
                    baseUrl = baseUrl + "startdate=" + startdate;
                    baseUrl = baseUrl + "&";
                    baseUrl = baseUrl + "enddate=" + enddate;

                    document.title = 'Web Clock Report';
                    window.open(baseUrl);
                }

                function OpenWebClockEmployeeReport(sender, customerid, employeeid, startdate, enddate) {

                    //alert(customerid);
                    //alert(employeeid);
                    //alert(startdate);
                    //alert(enddate);
                    var baseUrl = "Dialog/WebClockEmployeeReport.aspx";
                    baseUrl = baseUrl + "?";
                    baseUrl = baseUrl + "customerid=" + customerid;
                    baseUrl = baseUrl + "&";
                    baseUrl = baseUrl + "employeeid=" + employeeid;
                    baseUrl = baseUrl + "&";
                    baseUrl = baseUrl + "startdate=" + startdate;
                    baseUrl = baseUrl + "&";
                    baseUrl = baseUrl + "enddate=" + enddate;

                    document.title = 'Web Clock Employee Report';
                    window.open(baseUrl);
                }
            </script>
        </telerik:RadScriptBlock>

        <telerik:RadWindowManager RenderMode="Lightweight" ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false" ReloadOnShow="true" runat="server" EnableShadow="true">
            <Windows>
                <telerik:RadWindow RenderMode="Lightweight" ID="RadWindow1" runat="server" Height="400" Width="1000" NavigateUrl="~/Modules/TimeClock/Dialog/AddEditWebTime.aspx" OnClientClose="OnClientCloseHandler" Behaviors="Close" />
            </Windows>
        </telerik:RadWindowManager>

        <telerik:RadAjaxManager ID="RadRadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        <telerik:AjaxUpdatedControl ControlID="RadGrid2" />
                        <telerik:AjaxUpdatedControl ControlID="btnAdd" />
                        <telerik:AjaxUpdatedControl ControlID="btnEdit" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnRefreshGrids">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="btnRefreshGrids" />
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        <telerik:AjaxUpdatedControl ControlID="RadGrid2" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <ClientEvents />
        </telerik:RadAjaxManager>

        <asp:Panel runat="server" ID="pcustomerDateSelect">
            <div style="margin: 0px; height: 10%;">
                <table>
                    <tbody>
                        <tr>
                            <td>
                                <telerik:RadLabel runat="server" ID="radlabel1" Text="Customer ID"></telerik:RadLabel>
                            </td>
                            <td>
                                <uc1:CustomerIdField runat="server" ID="CustomerIdField" />
                            </td>
                            <td>
                                <telerik:RadLabel runat="server" ID="radlabel3" Text="Start Date"></telerik:RadLabel>
                            </td>
                            <td>
                                <telerik:RadDatePicker runat="server" ID="StartDate"></telerik:RadDatePicker>
                            </td>
                            <td>
                                <telerik:RadLabel runat="server" ID="radlabel4" Text="End Date"></telerik:RadLabel>
                            </td>
                            <td>
                                <telerik:RadDatePicker runat="server" ID="EndDate"></telerik:RadDatePicker>
                            </td>
                            <td>
                                <telerik:RadButton runat="server" ID="btnLoadCustomer" Text="Submit" OnClick="btnLoadCustomer_Click"></telerik:RadButton>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </asp:Panel>

        <telerik:RadAjaxPanel runat="server" ID="pCustomerEmployee" PostBackControls="btnExportGrid" Height="100%">
            <div style="margin: 0px; height: 5%; background-color: red;">
                <table>
                    <tbody>
                        <tr>
                            <td>
                                <telerik:RadLabel runat="server" ID="radlabel2" Text="Customer"></telerik:RadLabel>
                            </td>
                            <td width="30%">
                                <telerik:RadLabel runat="server" ID="lblCustomerIDName"></telerik:RadLabel>
                            </td>
                            <td width="30%">
                                <telerik:RadLabel runat="server" ID="lblSelectDate"></telerik:RadLabel>
                            </td>
                            <td width="15%">
                                <asp:LinkButton runat="server" ID="btnReport" Text="Web Clock Report" />
                                <%--<asp:LinkButton runat="server" ID="btnEmployeeReport" Text="Web Clock Employee Report" />--%>
                            </td>
                            <td width="25%">
                                <telerik:RadButton runat="server" ID="btnTimeImport" CssClass="rightAlign" Text="Import Time" OnClick="btnTimeImport_Click" />
                            </td>
                        </tr>
                    </tbody>
                </table>
                <telerik:RadButton ID="btnRefreshGrids" Text="Refresh" OnClick="btnRefreshGrids_Click" runat="server" Style="display: none;" />
            </div>

            <div style="margin: 0px; height: 50%; background-color: green;">
                <div>
                    <asp:ImageButton ID="btnExportGrid" runat="server" ImageUrl="/Images/Excel_XLSX.png" Height="24" Width="24" OnClick="btnExportGrid_Click" AlternateText="ExportToExcel" />
                </div>
                <telerik:RadGrid runat="server" ID="RadGrid1" Width="100%" Height="100%" AutoGenerateColumns="false" AllowPaging="False" AllowSorting="true" ShowGroupPanel="false" PageSize="10" RenderMode="Classic" AllowFilteringByColumn="true" GroupingSettings-CaseSensitive="false" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged" OnNeedDataSource="RadGrid1_NeedDataSource">
                    <MasterTableView Width="100%" >
                        <Columns>
                            <telerik:GridBoundColumn HeaderStyle-Width="0" SortExpression="Customerid" HeaderText="Customerid" HeaderButtonType="TextButton" DataField="Customerid" DataFormatString="{0:d}" />
                            <telerik:GridBoundColumn SortExpression="EmployeeID" HeaderText="EmployeeID" HeaderButtonType="TextButton" DataField="EmployeeID" DataFormatString="{0:d}" />
                            <telerik:GridBoundColumn SortExpression="FirstName" HeaderText="FirstName" HeaderButtonType="TextButton" DataField="FirstName" DataFormatString="{0:d}" />
                            <telerik:GridBoundColumn SortExpression="LastName" HeaderText="LastName" HeaderButtonType="TextButton" DataField="LastName" DataFormatString="{0:d}" />
                            <telerik:GridBoundColumn SortExpression="TotalHours" HeaderText="TotalHours" HeaderButtonType="TextButton" DataField="TotalHours" DataFormatString="{0:###,##0.00}" />
                        </Columns>
                    </MasterTableView>
                    <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True" EnablePostBackOnRowClick="true" Selecting-AllowRowSelect="true">
                        <Selecting AllowRowSelect="True"></Selecting>
                        <Resizing AllowRowResize="False" AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="False"></Resizing>
                        <Scrolling UseStaticHeaders="true" AllowScroll="true"  />
                    </ClientSettings>
                </telerik:RadGrid>
            </div>

            <div style="margin: 0px; height: 50%; background-color: yellow;">
                <div>
                    <asp:LinkButton runat="server" ID="btnAdd" Text="Add New Punch" OnClick="btnAdd_Click" Visible="false"></asp:LinkButton>
                </div>
                <telerik:RadGrid ID="RadGrid2" OnNeedDataSource="RadGrid2_NeedDataSource" runat="server" AutoGenerateColumns="false" AllowPaging="False" AllowSorting="true" ShowGroupPanel="false" PageSize="10" RenderMode="Classic" Width="100%" Height="100%" AllowFilteringByColumn="false" GroupingSettings-CaseSensitive="false" OnItemCreated="RadGrid2_ItemCreated" OnItemCommand="RadGrid2_ItemCommand">
                    <MasterTableView Width="100%">
                        <Columns>
                            <telerik:GridButtonColumn UniqueName="btnDelete" CommandName="Delete" ButtonType="LinkButton" Text="Delete" HeaderStyle-Width="45" HeaderText="Delete" ConfirmText="Do want to delete punch?" ImageUrl="../../Images/redx-md.png" />
                            <telerik:GridButtonColumn UniqueName="btnEdit" ButtonType="LinkButton" Text="Modify" HeaderText="Modify" HeaderStyle-Width="55" />
                            <telerik:GridBoundColumn HeaderStyle-Width="0" SortExpression="Customerid" HeaderText="Customerid" HeaderButtonType="TextButton" DataField="Customerid" DataFormatString="{0:d}" />
                            <telerik:GridDateTimeColumn SortExpression="dt" HeaderText="Date" HeaderButtonType="TextButton" DataField="dt" DataType="System.DateTime" DataFormatString="{0:M/d/yyyy}" />
                            <telerik:GridBoundColumn SortExpression="DayOfWeek" HeaderText="Day Of Week" HeaderButtonType="TextButton" DataField="DayOfWeek" DataFormatString="{0:d}" />
                            <telerik:GridBoundColumn HeaderStyle-Width="0" SortExpression="EmployeeID" HeaderText="EmployeeID" HeaderButtonType="TextButton" DataField="EmployeeID" DataFormatString="{0:d}" />
                            <telerik:GridBoundColumn HeaderStyle-Width="0" SortExpression="FirstName" HeaderText="FirstName" HeaderButtonType="TextButton" DataField="FirstName" DataFormatString="{0:d}" />
                            <telerik:GridBoundColumn HeaderStyle-Width="0" SortExpression="LastName" HeaderText="LastName" HeaderButtonType="TextButton" DataField="LastName" DataFormatString="{0:d}" />
                            <telerik:GridBoundColumn SortExpression="PunchID" HeaderText="PunchID" HeaderButtonType="TextButton" DataField="PunchID" DataFormatString="{0:d}" />
                            <telerik:GridDateTimeColumn SortExpression="PunchInDate" HeaderText="Punch In Date" HeaderButtonType="TextButton" DataField="PunchInDate" DataType="System.DateTime" DataFormatString="{0:M/d/yyyy}" />
                            <telerik:GridDateTimeColumn SortExpression="PunchInTime" HeaderText="Punch In Time" HeaderButtonType="TextButton" DataField="PunchInTime" DataType="System.DateTime" />
                            <telerik:GridDateTimeColumn SortExpression="PunchOutDate" HeaderText="Punch Out Date" HeaderButtonType="TextButton" DataField="PunchOutDate" DataType="System.DateTime" DataFormatString="{0:M/d/yyyy}" />
                            <telerik:GridDateTimeColumn SortExpression="PunchOutTime" HeaderText="Punch Out Time" HeaderButtonType="TextButton" DataField="PunchOutTime" DataType="System.DateTime" />
                            <telerik:GridBoundColumn SortExpression="Hours_Worked" HeaderText="Hours Worked" HeaderButtonType="TextButton" DataField="Hours_Worked" DataFormatString="{0:###,##0.00}" />
                        </Columns>
                    </MasterTableView>
                    <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True" EnablePostBackOnRowClick="true">
                        <Selecting AllowRowSelect="True"></Selecting>
                        <Resizing AllowRowResize="False" AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="False"></Resizing>
                        <Scrolling UseStaticHeaders="true" AllowScroll="true" />
                    </ClientSettings>
                </telerik:RadGrid>
            </div>
        </telerik:RadAjaxPanel>
    </div>
</asp:Content>

Eyup
Telerik team
 answered on 21 Feb 2018
1 answer
96 views

I have a RadGrid with a datasource and I added 4 more columns manually and I populate these 4 columns in the server side.

When I try to export the RadGrid data, the 4 columns that I added manually doesn't display the cell values.

Is there a configuration that I have to set?

Code client-side:

<telerik:RadGrid ID="radGridOLAUtilization" runat="server" AllowFilteringByColumn="True" AllowSorting="True" DataSourceID="sqlDataSource" CellSpacing="-1" >
    <ExportSettings ExportOnlyData="true" ></ExportSettings>
    <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
    <ClientSettings>
        <Scrolling AllowScroll="True" UseStaticHeaders="False" />
    </ClientSettings>
    <MasterTableView DataSourceID="sqlDataSource" AutoGenerateColumns="False" UseAllDataFields="true">
        <Columns>
            <telerik:GridBoundColumn DataField="PalletID" DataType="System.Int32" FilterControlAltText="Filter PalletID column" HeaderText="Pallet ID" SortExpression="PalletID" UniqueName="PalletID" HeaderStyle-HorizontalAlign="Center">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Station" FilterControlAltText="Filter Station column" HeaderText="Station" SortExpression="Station" UniqueName="Station" HeaderStyle-HorizontalAlign="Center">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="StartDateTime" DataType="System.DateTime" FilterControlAltText="Filter StartDateTime column" HeaderText="Start DateTime" SortExpression="StartDateTime" UniqueName="StartDateTime" HeaderStyle-HorizontalAlign="Center">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="EndDateTime" DataType="System.DateTime" FilterControlAltText="Filter EndDateTime column" HeaderText="End DateTime" SortExpression="EndDateTime" UniqueName="EndDateTime" HeaderStyle-HorizontalAlign="Center">                  </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="DeltaTime" DataType="System.TimeSpan" FilterControlAltText="Filter DeltaTime column" HeaderText="Delta Time" ReadOnly="True" SortExpression="DeltaTime" UniqueName="DeltaTime" HeaderStyle-HorizontalAlign="Center">
            </telerik:GridBoundColumn>
                    <!-- Columns added manually -->
               <telerik:GridBoundColumn DataField="TotalTime" DataType="System.TimeSpan" FilterControlAltText="Filter TotalTime column" HeaderText="Total Time" ReadOnly="True" SortExpression="TotalTime" UniqueName="TotalTime" HeaderStyle-HorizontalAlign="Center">
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn Display="false" DataField="DownTime" DataType="System.TimeSpan" FilterControlAltText="Filter DownTime column" HeaderText="DownTime" ReadOnly="True" SortExpression="DownTime" UniqueName="DownTime" HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataType="System.TimeSpan" FilterControlAltText="Filter AccumulatedDownTime column" HeaderText="Accumulated DownTime" ReadOnly="True" SortExpression="AccumulatedDownTime" UniqueName="AccumulatedDownTime" HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataType="System.String" FilterControlAltText="Filter UtilizationTime column" HeaderText="Utilization Time" ReadOnly="True" SortExpression="UtilizationTime" UniqueName="UtilizationTime" HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
</Columns>
    </MasterTableView>
</telerik:RadGrid>

Server-side:

protected void Page_Load(object sender, EventArgs e)
        {
            double AccumulatedDeltaTime = 0;
 
            for (int i = 0; i < radGridOLAUtilization.Items.Count; i++)
            {
                TableCell accumulatedDownTimeCell = radGridOLAUtilization.Items[i]["AccumulatedDownTime"];
                TableCell DownTimeCell = radGridOLAUtilization.Items[i]["DownTime"];
                TableCell deltaTimeCell = radGridOLAUtilization.Items[i]["DeltaTime"];
                TableCell accumulatedUtilizationTimeCell = radGridOLAUtilization.Items[i]["UtilizationTime"];
                TableCell totalTimeCell = radGridOLAUtilization.Items[i]["TotalTime"];
                AccumulatedDeltaTime += TimeSpan.Parse(deltaTimeCell.Text).TotalSeconds;
                 
                if (i == 0)
                {
                    accumulatedDownTimeCell.Text = "00:00:00";
                    accumulatedUtilizationTimeCell.Text = "100%";
                    totalTimeCell.Text = deltaTimeCell.Text;
                }
                else
                {
                    TableCell previousAccumulatedDownTimeCell = radGridOLAUtilization.Items[i - 1]["AccumulatedDownTime"];
                    TableCell previousTotalTimeCell = radGridOLAUtilization.Items[i - 1]["TotalTime"];
                    double accumulatedDownTime = TimeSpan.Parse(previousAccumulatedDownTimeCell.Text).TotalSeconds + TimeSpan.Parse(DownTimeCell.Text).TotalSeconds;
                    accumulatedDownTimeCell.Text = TimeSpan.FromSeconds(accumulatedDownTime).ToString();
                    int accumulatedUtilizationTime = (int)(100 * AccumulatedDeltaTime / (AccumulatedDeltaTime + accumulatedDownTime));
                    accumulatedUtilizationTimeCell.Text = accumulatedUtilizationTime.ToString() + "%";
                    double totalTime = AccumulatedDeltaTime + accumulatedDownTime;
                    totalTimeCell.Text = TimeSpan.FromSeconds(totalTime).ToString();
                }
            }
        }
     
        protected void btnExportToExcel_Click(object sender, EventArgs e)
        {
            //radGridOLAUtilization.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;
            radGridOLAUtilization.ExportSettings.FileName = "Alerts Data";
            radGridOLAUtilization.ExportSettings.IgnorePaging = true;
            //radGridOLAUtilization.MasterTableView.ExportToExcel();
            radGridOLAUtilization.MasterTableView.ExportToCSV();
        }
Eyup
Telerik team
 answered on 21 Feb 2018
11 answers
727 views
Hi.

I have a difficult problem attemting to validate a change in a RadComboBox that is in the EditItemTemplate of a RadGrid GridTemplateColumn.  I have two such combo boxes in the EditTemplate(s), and I wnat to validate the changed to value of one against the vlaue of the other.  So when the user changes the combobox "startime", the validation code examines the value (not the text) of the "endtime" combobox (and the same thing validating the "endtime" change against the "starttime").  What code must I put in the ServerValidate event for one combobox to find the control that is the other combobox?  I looked through all the local objects of the radgrid during debug, and cannot find these.  Declarative syntax below:

    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="sdsCRNAShifts" GridLines="None" Skin="Simple" 
        AutoGenerateColumns="False" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" PageSize="128" Width="100%" AllowSorting="True" OnEditCommand="RadGrid1_EditCommand" > 
        <MasterTableView DataSourceID="sdsCRNAShifts" CommandItemDisplay="Top" DataKeyNames="shiftID" > 
            <Columns> 
                <telerik:GridCheckBoxColumn DataField="active" HeaderText="active" UniqueName="active" AllowFiltering="False" AllowSorting="False">  
                    <HeaderStyle Width="20px" /> 
                </telerik:GridCheckBoxColumn> 
                <telerik:GridDropDownColumn DataField="shiftType" DataSourceID="XmlDataSource1"  HeaderText="Type" 
                    ListValueField="ID" ListTextField="Text" UniqueName="shiftType" > 
                    <ItemStyle Width="60px" /> 
                    <HeaderStyle Width="60px" /> 
                </telerik:GridDropDownColumn> 
                <telerik:GridBoundColumn DataField="shiftName" HeaderText="Name" UniqueName="shiftName" ColumnEditorID="GridTextBoxColumnEditor1" > 
                    <HeaderStyle Width="120px" /> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="shiftDescr" HeaderText="Description" UniqueName="shiftDescr" ColumnEditorID="GridTextBoxColumnEditor2" AllowSorting="False" > 
                    <HeaderStyle Width="200px" /> 
                </telerik:GridBoundColumn> 
                <telerik:GridTemplateColumn DataField="bOff" HeaderText="BeginTime" UniqueName="bOff">  
                    <EditItemTemplate> 
                        <telerik:RadComboBox ID="bOffRadComboBox" runat="server" DataSourceID="sdsTimeText" 
                            DataTextField="timeText" DataValueField="numMins" SelectedValue='<%# Bind("bOff") %>' AutoPostBack="True" OnSelectedIndexChanged="bOffRadComboBox_SelectedIndexChanged">  
                        </telerik:RadComboBox> 
                        <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="StartTime must precede EndTime" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator> 
                    </EditItemTemplate> 
                    <ItemTemplate> 
                        <asp:Label ID="bOffLabel" runat="server" Text='<%# Eval("beginTime") %>'></asp:Label> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="eOff" HeaderText="EndTime" UniqueName="eOff">  
                    <EditItemTemplate> 
                        <telerik:RadComboBox ID="eOffRadComboBox" runat="server" DataSourceID="sdsTimeText" 
                            DataTextField="timeText" DataValueField="numMins" SelectedValue='<%# Bind("eOff") %>' AutoPostBack="True">  
                        </telerik:RadComboBox> 
                        &nbsp;  
                        <asp:CustomValidator ID="CustomValidator2" runat="server" ErrorMessage="EndTime must follow StartTime" OnServerValidate="CustomValidator2_ServerValidate"></asp:CustomValidator> 
                    </EditItemTemplate> 
                    <ItemTemplate> 
                        <asp:Label ID="eOffLabel" runat="server" Text='<%# Eval("endTime") %>'></asp:Label> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridEditCommandColumn ButtonType="ImageButton">  
                    <HeaderStyle Width="50px" /> 
                </telerik:GridEditCommandColumn> 
            </Columns> 
            <EditFormSettings> 
                <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record" UniqueName="EditCommandColumn1" CancelText="Cancel edit">  
                </EditColumn> 
            </EditFormSettings> 
       </MasterTableView> 
        <ClientSettings> 
            <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
 

Thank you for any and all help!

Tom Stanley

Eyup
Telerik team
 answered on 21 Feb 2018
2 answers
77 views

Telerik.Web.UI:  2017.3.913.45

 

I am using RadTextBox and trying to load the content of the XML file using c# code. This works fine without any issues and loads the XML content. After loading it, the partial just  work and it fails. It post at all.  I was able to repro this issue and it's very simple to do that. Is this a known issue? Any fix?

 

 

Ravi
Top achievements
Rank 1
 answered on 21 Feb 2018
0 answers
102 views

Hello,

I'm using the Load On Demand Scenario & I'm attempting to force all child nodes to collapse when its parent has collapsed. Here is the code that I have so far. Any help on this would be greatly appreciated.

Private Sub iTeam_DynamicOrgChart_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim oConn As New System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("Connection").ConnectionString)
        Dim oCmd As New SqlCommand
        Dim oData As SqlDataReader
        Dim oAdapter As New SqlDataAdapter(oCmd)
        Dim oDataSet As New DataSet
 
        Try
            oConn.Open()
 
            'get employee hierarchy
            With oCmd
                .Parameters.Clear()
                .Connection = oConn
                .CommandType = Data.CommandType.StoredProcedure
                .CommandText = "EmployeeHierachySP"
                .Parameters.AddWithValue("@NameOnly", NameOnly.Checked)
            End With
            oAdapter.Fill(oDataSet)
 
            With OrgChart
                .DisableDefaultImage = True
                .LoadOnDemand = OrgChartLoadOnDemand.Nodes
                .EnableDrillDown = True
                .PersistExpandCollapseState = True
                .DataTextField = "UserName"
                .DataFieldID = "UserID"
                .DataFieldParentID = "ManagerUserID"
                .DataCollapsedField = "Collapsed"
                .DataSource = oDataSet
                '.GroupColumnCount = 4
                '.GroupEnabledBinding.GroupItemBindingSettings.DataTextField = "UserName"
                '.GroupEnabledBinding.GroupItemBindingSettings.DataFieldID = "UserID"
                '.GroupEnabledBinding.GroupItemBindingSettings.DataFieldNodeID = "ManagerUserID"
                '.GroupEnabledBinding.GroupItemBindingSettings.DataSource = oDataSet
                '.GroupEnabledBinding.NodeBindingSettings.DataFieldID = "UserID"
                '.GroupEnabledBinding.NodeBindingSettings.DataFieldParentID = "ManagerUserID"
                '.GroupEnabledBinding.NodeBindingSettings.DataSource = oDataSet
 
                .DataBind()
            End With
 
        Catch ex As Exception
            Response.Write(ex.ToString)
        Finally
            oConn.Dispose()
            oConn = Nothing
            oCmd = Nothing
            oData = Nothing
            oDataSet.Dispose()
            oDataSet = Nothing
            oAdapter.Dispose()
            oAdapter = Nothing
        End Try
    End Sub
 
 
    Protected Sub OrgChart_NodeDataBound(sender As Object, e As Telerik.Web.UI.OrgChartNodeDataBoundEventArguments) Handles OrgChart.NodeDataBound
        ''e.Node.CssClass = "SmallNode"
        'If e.Node.Level = 1 Then
        '    e.Node.Collapsed = True
        'ElseIf e.Node.Level > 1 Then
        '    'e.Node.Collapsed = False
        'End If
 
        e.Node.CssClass = "Level" & e.Node.Level
 
        For Each oGroupItem As OrgChartGroupItem In e.Node.GroupItems
            If NameOnly.Checked Then
                oGroupItem.CssClass = "SmallNodeNameOnly"
            Else
                oGroupItem.CssClass = "SmallNode"
            End If
        Next
    End Sub
 
    Private Sub OrgChart_NodeExpandCollapse(sender As Object, e As OrgChartNodeExpandCollapseEventArguments) Handles OrgChart.NodeExpandCollapse
        Try
 
            If e.State = OrgChartNodeExpandCollapseState.NodeCollapsed Then
 
                For Each employee As OrgChartNode In e.SourceNode.Nodes
                    employee.Collapsed = True
                Next
            End If
        Catch ex As Exception
 
        End Try
    End Sub
Johnathan
Top achievements
Rank 1
 asked on 20 Feb 2018
3 answers
198 views

Hi, we're trying to use the ASP.NET AJAX controls in our SharePoint pages as visual web parts. We've only used the RadGrid, RadComboBox & RadAjaxManager and they seem to work for the most part. We're trying to incorporate the RadScriptManager as well. We can't add it inside the web part as SharePoint throws the error "Only one instance of a ScriptManager can be added to the page". Which makes sense as the MasterPage (seattle.master) uses a ScriptManager. So, we've tried removing the ScriptManager and replace it with RadScriptManager like:

<!--SPM:<asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true"/>-->

to

<!--SPM:<telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true"/>-->

 

The <!--SPM:--> tag is used in the seattle.html because MS don't recommend you edit the seattle.master file directly in SharePoint 2013. But it throws the same error "Only one instance of a ScriptManager can be added to the page" in the ULS logs. It's like SharePoint is ignoring the RadScriptManager control.

 

Any thoughts?

 

We're using version 2018.1.117.40 of the ASP.NET AJAX controls and SharePoint 2013 (15.0.4569.1000) with the latest patches as at 2018/02/16.

Vessy
Telerik team
 answered on 20 Feb 2018
5 answers
127 views
Hi,

I looked at plenty of code and can't really find a clear answer.

What I want to do is have a grid with paging, sorting and filtering. Once I bind my dataset (read only, no CRUD), even if i use pagination and filters, i want all the dataset to be downloaded (may be up to 3000 records) and then everything like filtering, changing page and sorting be done client side without using any callback to AJAX nor Postback.  

The reason is that the call to the database has so many calculations that it takes forever to get the dataset to be filled. The user won't wait 30 to 40 sec each time he clicks on one of the features.

Also, I don't want to cache the resultset inside the session or on a temporary file on the server.  I want it all in the browser.

This will be use on a private Intranet on IE8.
It is not intended for a wide audience.

Is that possible?
And if so, how do i do it?

Kindest regards,

Michel
Bibek
Top achievements
Rank 2
 answered on 20 Feb 2018
0 answers
106 views

Hi

Is there a way to check (boolean) if the file is pass / fail clientside validation in OnClientFileSelected?

I want to create a form which the submit button is disabled if RadAsyncUpload has files that failed at client side validation. Then enable submit button when there's no fail validation in the list (OnClientFileUploadRemoved event).

I know failed file won't appear in UploadedFiles but still, I need that validation check which  boolean.

Any idea?

 

thanks

Dika
Top achievements
Rank 1
 asked on 20 Feb 2018
7 answers
373 views
I have a grid and I am exporting to excel.

On the web page, I have a DateTime field that displays using the following format:

 
<telerik:GridBoundColumn HeaderText="Message Date" DataField="messageDate" UniqueName="messageDate" SortExpression="messageDate" ShowSortIcon="false" DataFormatString="{0:MM/dd/yyyy hh:mm:ss tt}" DataType="System.DateTime" ></telerik:GridBoundColumn>

On the web page the seconds get displayed. When I export the grid to Excel the seconds are no longer displayed.
The field is displayed on the spreadsheet like the following : 07/21/10 10:06 AM.

If I click on the cell and look at the data for the cell the seconds are indeed there.
How do I force Excel to use my specific DateTime format?

Thanks for the help.

Felipe
Attila Antal
Telerik team
 answered on 20 Feb 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?