Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
90 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
704 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
75 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
97 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
188 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
122 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
99 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
361 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
0 answers
97 views

Hi all,

i want to have a repeated table with forms. One guy sayd, that i should use grid for this. So i want to create something like:

<grid ID="Grid1" runat="server" DataSourceID=???>

<MasterTableView  DataKeyNames="fldId" DataSourceID=??? AutoGenerateColumns="False">

<form runat="server" ID=??? DataSourceID=??? DataKeyNames="fldId">

</form>

</MasterTableView >

</grid>

The form is created with fields from DB based on the fldId and i want to have repeated forms with all fldId's. I hope your can understand my idea.

 

Thank you in advance!

Alexey
Top achievements
Rank 1
 asked on 20 Feb 2018
0 answers
88 views

Hi,

is it possible to diable the automatic calculation of a summary task. My goal is it to have a specifiv start and end for the summary task not depending on the start and end of the child-tasks.

best regards

Thorsten

Thorsten
Top achievements
Rank 1
 asked on 20 Feb 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?