Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
358 views

Hi

We are using a 2 language system and set the headers of the RadGrid according to the user's selected language and works fine for display. The RadGrid should be able to export to Excel and CSV. The excel exports the headers correctly, but the CSV only uses default column names set in the ASPX file. We are using version 2015.2.729. Here is an abbreviated version of our code:

<telerik:RadGrid ID="grdBlocked" runat="server" AutoGenerateColumns="False" OnItemDataBound="grdBlocked_ItemDataBound" OnNeedDataSource="grdBlocked_NeedDataSource" OnInfrastructureExporting="grdBlocked_InfrastructureExporting" OnGridExporting="grdBlocked_GridExporting" OnItemCommand="grdBlocked_ItemCommand">
                    <ExportSettings ExportOnlyData="True" IgnorePaging="true">
                        <Excel Format="Xlsx" FileExtension=".xlsx" />
                    </ExportSettings>
                    <MasterTableView DataKeyNames="StudentNumber, DateBlocked" CommandItemDisplay="Top">
                        <CommandItemSettings ExportToPdfText="Export to PDF" ShowAddNewRecordButton="False" ShowExportToCsvButton="True" ShowExportToExcelButton="True" ShowExportToPdfButton="False" ShowExportToWordButton="False" ShowRefreshButton="False"></CommandItemSettings>
                        <Columns>
                            <telerik:GridBoundColumn DataField="StudentNumber" HeaderText="Student number" UniqueName="StudentNumber"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Name" HeaderText="Student Name" UniqueName="Name"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="DateBlocked" HeaderText="Date" UniqueName="Date" DataType="System.DateTime" DataFormatString="{0:yyyy/MM/dd HH:mm}"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="BlockedUser" HeaderText="User" UniqueName="User"></telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>

 

Code behind (read comments):

using System;
using System.Web.UI;
using Telerik.Web.UI;
 
namespace WritingCentreOnlineBookings.Reports
{
    public partial class BlockedAccounts : System.Web.UI.Page
    {
        private Includes.Site masterPage = new Includes.Site();
        private WebAPICalls MyWebAPI = new WebAPICalls();
 
        protected void BindData()
        {
            grdBlocked.DataSource = MyWebAPI.GetDataTable("GetBlockedStudents");
            grdBlocked.DataBind();
        }
 
        protected void grdBlocked_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Header)
            {
                GridHeaderItem header = (GridHeaderItem)e.Item;
                header["StudentNumber"].Text = (masterPage.LanguageCode == "afr" ? "Studentenommer" : "Student number");
                header["Name"].Text = (masterPage.LanguageCode == "afr" ? "Naam van student" : "Student name");
                header["Date"].Text = (masterPage.LanguageCode == "afr" ? "Datum" : "Date");
                header["User"].Text = (masterPage.LanguageCode == "afr" ? "Geblok deur" : "Blocked by");
            }
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            masterPage = (Includes.Site)Master;
 
            if (!Page.IsPostBack)
            {
                BindData();
            }
        }
 
        protected void grdBlocked_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            grdBlocked.DataSource = MyWebAPI.GetDataTable("GetBlockedStudents");
        }
 
        //Tried to change the column headers here, but it never gets called for CSV, only for excel
        protected void grdBlocked_InfrastructureExporting(object sender, GridInfrastructureExportingEventArgs e)
        {
            for (int i = 2; i <= e.ExportStructure.Tables[0].Rows.Count; i++)
            {
                var cell = e.ExportStructure.Tables[0].Cells[1, i];
                //Forces the student number to be text in Excel
                cell.Format = "@";
                cell = e.ExportStructure.Tables[0].Cells[3, i];
                cell.Value = ((DateTime)cell.Value).ToString("yyyy-MM-dd HH:mm");
            }
        }
 
        //Documentation suggests this is the place to add customization. It gets called, but does not seem to have an effect
        protected void grdBlocked_GridExporting(object sender, GridExportingArgs e)
        {
            GridItem[] headerItems = grdBlocked.MasterTableView.GetItems(GridItemType.Header);
            headerItems[0].Cells[2].Text = (masterPage.LanguageCode == "afr" ? "Studentenommer" : "Student number");
        }
 
        //Also tried to rebind, just to make sure the column headers are loaded
        protected void grdBlocked_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.ExportToCsvCommandName)
            {
                grdBlocked.Rebind();
            }
        }
    }
}
MBEN
Top achievements
Rank 2
Veteran
 answered on 03 Oct 2018
1 answer
173 views

Hi,

We are currently using  RadGrid to display a list of items. The number of items are now about 8000 records and has lead to timeouts when navigating to different pages. After further inspection, the  RadGrid control is sending all the data back to the server when the user changes to a different page. The total amount of data in our case is around  35MB. Is there something I am missing in the configuration of this grid? is this the normal behavior of the grid?

Thanks in advance for your help.

Fidel
Top achievements
Rank 1
 answered on 03 Oct 2018
13 answers
855 views
Hi,
 I am using GridClientSelectColumn for Selecting a row in a grid.i want to check whether the check box is checked or not in ServerSide.i have tried a lot but all in vain.
I am not using GridTemplateColumn since I have some restrictions for in my reqs.
Please give me some code snipets if possible
Please Help me .

Thanks,
A2H
Eyup
Telerik team
 answered on 03 Oct 2018
1 answer
109 views

I have a question that is pretty basic, but for me as a new developer it's hard to figure this out.

I will try to explain it as good as i can.

I have 3 different .aspx pages where i have different RadGrid tables. And in each of them i have made Excel export available. I have made aspx.cs code in each of them but now i'm trying to put everything in just on class. My problem is that i don't know how to make a method that can get the ExportSettings to work for each of the RadGrids. 

 

This is my method i made in the new class and "gvShipmentList" ist the name on one of my RadGrids. What do i have to do so i can reach all of my RadGrids through this method?

------------------------------------------

public static void ExportExcelOnItemCommand(object sender, GridCommandEventArgs e) {
            if (e.CommandName == RadGrid.ExportToExcelCommandName)
            {
                
                gvShipmentList.ExportSettings.FileName = "ShipmentList";
                gvShipmentList.ExportSettings.ExportOnlyData = true;
                gvShipmentList.ExportSettings.IgnorePaging = true;
                gvShipmentList.ExportSettings.OpenInNewWindow = true;

                gvShipmentList.GridLines = GridLines.Both;

                foreach (GridColumn column in gvShipmentList.MasterTableView.Columns)
                {
                    column.Visible = column.Display;
                }

                gvShipmentList.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
                gvShipmentList.MasterTableView.ExportToExcel();
            }
        }

-------------------------------

I hope someone can help me, and please, if i haven't given enough information then tell me so i can provide you with more. Like i said, i'm very new at this and trying to learn. But this was too hard.

 

Kind regards Tim

Attila Antal
Telerik team
 answered on 03 Oct 2018
4 answers
1.0K+ views

Hi,

I am using RadSpell and RadEditor, and have put following in web.config, but I still get error: "Web.config registration missing! The Telerik dialogs require a HttpHandler registration in the web.config file....". Why do I still get this error, and how do I make it go away ? Thank you.

 

<httpHandlers>
    ...
    <add path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler" validate="false" />
</httpHandlers>
...
<system.webServer>  
    <handlers>    
        ...    
        <add name="Telerik_Web_UI_DialogHandler_aspx" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" />  
    </handlers>
</system.webServer>
Rumen
Telerik team
 answered on 03 Oct 2018
0 answers
84 views

Hi,

     I am facing issue while recording with telerik in chrome,the recording dead slow.Can you please suggest me how to solve it?

 

Thanks & Regards

Vimala Padakanti

 

Vimala
Top achievements
Rank 1
Veteran
 asked on 03 Oct 2018
5 answers
148 views

I must be doing something wrong, but can't make stacked bar to look the same as "not stacked".

Picture attached.

Can you recommend approach, please?

Vessy
Telerik team
 answered on 03 Oct 2018
2 answers
85 views

I am using VS 2017 and Telerik UI for ASP.NET AJAX R3 2018. When I create a new Telerik Project using the Telerik C# Web Forms Site Template (Blank) and I add the following snippet to the placeholder div tag in the Default.aspx page ...

<telerik:RadTextBox
            ID="RadTextBox1"
            runat="server"
            Skin="WebBlue">
        </telerik:RadTextBox>
        <asp:RequiredFieldValidator
            ID="TextBoxRequiredFieldValidator"
            runat="server"
            Display="Dynamic"
            ControlToValidate="RadTextBox1"
            ErrorMessage="The textbox can not be empty!">
        </asp:RequiredFieldValidator>

 

... then the client side validation is not working.

When I enter a text and remove it, then the error message is not shown.

 

When I add jQuery by <script src="Scripts/jquery.min.js"></script> then client side validation is working.

That is not the correct solution as jQuery is already loaded by the telerik web ui assembly.

Adding a ScriptReference or a script ressource mapping is not solving the issue.

So, how I have to set up a telerik project to get the asp validators working as expected?

Kai-Uwe
Top achievements
Rank 1
 answered on 02 Oct 2018
2 answers
64 views

I would like to filter the FileExplorer results by combining a Session variable id and the remainder of the string.  

We have a IssueID and a issue may have files associated with it.  Once a supporting document file is uploaded it will have "<issueID>_" appended to the front, ie. 1009_myfile.txt.  I need the search pattern to be something like Session("IssueID") & "_*.*".  

How do I go about doing this?  

Here is code the client-side control

<telerik:RadFileExplorer ID="RadFileExplorer1" runat="server"
    EnableCreateNewFolder="false" Height="225" Width="890" EnableAsyncUpload="false">
    <Configuration ViewPaths="/SupportingDocs/" DeletePaths="/SupportingDocs/" />
</telerik:RadFileExplorer>

 

Tried the following in my code behind in the Page Load to no avail.  

Dim searchPatterns As String() = RadFileExplorer1.Configuration.SearchPatterns
searchPatterns = Session("IssueID") & "_*"
RadFileExplorer1.Configuration.SearchPatterns = searchPatterns

 

Vessy
Telerik team
 answered on 02 Oct 2018
1 answer
203 views

I have a radgrid that's in a NestedViewTemplate.  Basically a details grid.  I'm trying to access a combo box  that's inside the grid in the NestedViewTemplate.   

 

How can I find that control inside the details grid that's in a NestedViewTemplate

 

Thanks in advance

 

Eyup
Telerik team
 answered on 02 Oct 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?