Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
219 views
Hi,
I have implemented custom export functionality to export RadGrid data.
I have added a menu “Export All Columns” to HeaderContextMenu of Grid, which when clicked Grid data should be exported to CSV.

RadGrid is ajaxified using RadAjaxManager:
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PanelVendor" />
                    <telerik:AjaxUpdatedControl ControlID="pnlGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
            </UpdatedControls>
        </telerik:AjaxSetting>        <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="UsersGrid">
            <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="UsersGrid" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

Following this link http://www.telerik.com/support/code-library/export-radgrid-content-to-excel-word-csv-pdf-with-ajax-enabled , I have added javascript code to disable ajax and make standard postback:
function onRadAjaxRequestStart(ajaxManager, eventArgs) {
    if (eventArgs.EventTargetElement.value != undefined && eventArgs.EventTargetElement.value.indexOf("Export") != -1) {
        eventArgs.set_enableAjax(false);
        ajaxManager.set_enableAJAX(false);
    }
}

Now this all works fine and data is exported to CSV when “Export All Columns” header menu is clicked.
But the RadAjaxLoadingPanel is displayed on the grid and it does not go away even after CSV is downloaded.

What do I need to do so that RadAjaxLoadingPanel does not appear while exporting?
Lenny_shp
Top achievements
Rank 2
 answered on 07 Oct 2015
1 answer
189 views

Hi All,

I am creating two dialogs: a parent and its child.
Parent  has size 1082x630

Child has size 1500x900

On parent dialog, when I click on button "Show Child Dialog", its child will be shown.

The problem here is the size of child dialog larger than its parent. So, I want to resize the size of child dialog and show it in the center of its parent dialog.

And here is my code in Javascript that I use for resizing child dialog manually. To center child dialog, I also use childRadWindow.left and BUT, it does not work as my expected. The child dialog does not place in the center of its parent.

Please reference my expected, actual images and my code to get the problem.

My expected result: https://drive.google.com/file/d/0B7thkzS9kbhkY1ZMcW9LNGdCZ0E/view?usp=sharing

Actual result: https://drive.google.com/file/d/0B7thkzS9kbhkLU9nLVA2LVU0TDg/view?usp=sharing 

Here is my code to resize child dialog manually. I put it on child dialog *.   

<script type="text/javascript">
     $(document).ready(function () {
         resizeRWndDialog();
     });       
</script>
function resizeRWndDialog() {
    var radWindows = [];
    var radWindow = GetRadWindow();
    while (true) {
        if (radWindow != undefined && radWindow != null) {
            radWindows.push(radWindow._popupElement);
            radWindow = radWindow.BrowserWindow.GetRadWindow();
        } else {
            break;
        }
    }
    var numsOfRadWindow = radWindows.length - 1;
    if (numsOfRadWindow > 0) {
        for (var i = numsOfRadWindow; i > 0; i--) {
            var parentWindow = radWindows[i];
            var parentWidth = parentWindow.clientWidth;   //parentWidth =1082
            var parentHeight = parentWindow.clientHeight; //parentHeight = 630
 
            var chidWindow = radWindows[i - 1];
            var childWidth = chidWindow.clientWidth;    //childWidth = 1500
            var childHeight = chidWindow.clientHeight;  //childHeight = 900
 
            var rateMinWidth = 0,
                rateMinHeight = 0,
                rateMaxWidth = 0,
                rateMaxHeight = 0;
 
            if (chidWindow.style.minWidth != "") {
                rateMinWidth = parseInt(chidWindow.style.minWidth) / childWidth;
            }
 
            if (chidWindow.style.minHeight != "") {
                rateMinHeight = parseInt(chidWindow.style.minHeight) / childHeight;
            }
 
            if (chidWindow.style.maxWidth != "") {
                rateMaxWidth = parseInt(chidWindow.style.maxWidth) / childWidth;
            }
 
            if (chidWindow.style.maxHeight != "") {
                rateMaxHeight = parseInt(chidWindow.style.maxHeight) / childHeight;
            }
 
            if ((parentWidth - 40) > 0 && childWidth >= parentWidth - 40) {
                childWidth = parentWidth - 40;    //parentWidth = 1082, childWidth = 1042
            }
 
            if ((parentHeight - 80) > 0 && childHeight >= parentHeight - 80) {
                childHeight = parentHeight - 80;    //parentHeight = 630, childHeight = 550
            }
 
            setSizeRWndDialog(chidWindow.getElementsByClassName("rwTable")[0], rateMinWidth * childWidth, rateMinHeight * childHeight, rateMaxWidth * childWidth, rateMaxHeight * childHeight, childWidth, childHeight);
            setSizeRWndDialog(chidWindow, rateMinWidth * childWidth, rateMinHeight * childHeight, rateMaxWidth * childWidth, rateMaxHeight * childHeight, childWidth, childHeight);
 
            chidWindow.left = Math.round((parentWidth - childWidth) / 2, 0) + "px";
            chidWindow.top = Math.round((parentHeight - childHeight) / 2, 0) + "px";
            chidWindow.focus();
            radWindows[i - 1] = chidWindow;
        }
    }
}
 
function setSizeRWndDialog(element, minWidth, minHeight, maxWidth, maxHeight, width, height) {
    if (minWidth != 0 && minHeight != 0) {
        element.style.minWidth = minWidth + "px";
        element.style.minHeight = minHeight + "px";
    }
 
    if (maxWidth != 0 && maxHeight != 0) {
        element.style.maxWidth = maxWidth + "px";
        element.style.maxHeight = maxHeight + "px";
    } else {
        element.style.maxWidth = width + "px";
        element.style.maxHeight = height + "px";
    }
 
    element.style.width = width + "px";
    element.style.height = height + "px";
}

Henshi
Top achievements
Rank 1
 answered on 07 Oct 2015
3 answers
65 views

I'm having problems with my combobox, when i press button (letter for element) I seek that corresponding element will highlight, which it does, however it is out of bounds.
I've attached picture, the hidden element is next after the last one visible that got highlighted, which is fine, however the user has to scroll a little bit more to actually see the element to which he was redirected to, how can I fix this?

                  Input = new RadComboBox                 {                 ID = "input_" + param.Name,                 EnableEmbeddedSkins = false,                 Skin = "Tabbed",                 AutoPostBack = true,                 Width = new Unit (100,UnitType.Percentage),                 Height = new Unit(100, UnitType.Percentage),                 DropDownCssClass = "Ellipsis",                 CssClass = "FullLength",                 MaxHeight = new Unit(220, UnitType.Pixel),                 CheckBoxes = Multiselect,                 EnableCheckAllItemsCheckBox = Multiselect //,ItemTemplate = CreateItemTemplate()                             };             Input.Style.Add ("margin-top", "5px");             Input.Style.Add ("margin-bottom", "5px");             if (!Multiselect)                 Input.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(input_SelectedIndexChanged);             else                 {                 Input.ItemChecked += new RadComboBoxItemEventHandler(Input_ItemChecked);                 Input.CheckAllCheck += new RadComboBoxCheckAllCheckEventHandler(Input_CheckAllCheck);                 }

Domantas
Top achievements
Rank 1
 answered on 07 Oct 2015
6 answers
103 views

Ideally, i would like to export my grids to one file, but seems i will need to create wrapper grid around my grids and it would not fit my scenario. Second option for is to create two separate export files. However, i am getting only second file saved. Here is my approach:

Export(grid, subName, strCenterHeader, alternateText)

Export(grid2, subName2, strCenterHeader2, alternateText)

Protected Sub Export(ByVal grid As RadGrid, _
                         ByVal subName As String, _
                         ByVal strCenterHeader As String, _
                         ByVal alternateText As String)

        grid.ExportSettings.FileName = TredisSession.Current.Project.ProjectName.Replace(" ", "_") & "_" & subName & "_Data"

        grid.ExportSettings.ExportOnlyData = True
        grid.ExportSettings.OpenInNewWindow = True
        grid.ExportSettings.UseItemStyles = True

        Select Case alternateText

            Case "HTML"
                grid.ExportSettings.Excel.Format = GridExcelExportFormat.Html
                grid.MasterTableView.ExportToExcel()

            Case "ExcelML"
                grid.ExportSettings.Excel.Format = DirectCast([Enum].Parse(GetType(GridExcelExportFormat), alternateText), GridExcelExportFormat)
                grid.MasterTableView.ExportToExcel()

            Case "Xlsx"
                grid.ExportSettings.Excel.Format = DirectCast([Enum].Parse(GetType(GridExcelExportFormat), alternateText), GridExcelExportFormat)
                grid.MasterTableView.ExportToExcel()

            Case "PDF"

                Dim footerMiddleCell As String = "<?page-number?>"

                ' to get lanscape orientation
                grid.ExportSettings.Pdf.PageHeight = Unit.Parse("200mm")
                grid.ExportSettings.Pdf.PageWidth = Unit.Parse("500mm")

                grid.ExportSettings.Pdf.PageHeader.MiddleCell.Text = strCenterHeader
                grid.ExportSettings.Pdf.PageHeader.MiddleCell.TextAlign = GridPdfPageHeaderFooterCell.CellTextAlign.Center

                grid.ExportSettings.Pdf.PageFooter.MiddleCell.Text = footerMiddleCell
                grid.ExportSettings.Pdf.PageFooter.MiddleCell.TextAlign = GridPdfPageHeaderFooterCell.CellTextAlign.Center

                grid.MasterTableView.ExportToPdf()

            Case "Doc"
                grid.MasterTableView.ExportToWord()

            Case "CSV"
                grid.MasterTableView.ExportToCSV()

        End Select

    End Sub

Thank you

Pavlina
Telerik team
 answered on 07 Oct 2015
0 answers
80 views

Hello,

I've updated the telerik version to the new Q3 2015 version to get the functionality of resizing columns inside the gantt. But then I had to recognize that if I set the width of my GanttBoundColumn in percent it is completely ignored.

Futhermore if a full postback is performed the width of the columns is not stored and is set back to the default width. Is there a way to accomplish saving the width of the column ​if a full postback is performed?
Thanks.

Regards,
Felix

Felix
Top achievements
Rank 1
 asked on 07 Oct 2015
0 answers
67 views

Hello,

quite a while ago a topic came up that the DisplayDeleteConfirmation is not working properly if a dependency is about to be deleted when a full post back is performed. The popup opens and then closes immediatly. I wonder by when this bug will be fixed because for me it is an quite important functionality that the user is asked again if he really wants to delete the task or the dependency.

Thanks in advance.
Regards,
Felix

Felix
Top achievements
Rank 1
 asked on 07 Oct 2015
3 answers
194 views

Using any data source, I can create the necessary hierarchy for a menu system using the RadNavigation.  However, I have no examples or knowledge on how to activate associated URLs for each of the nodes. 
If JavaScript is required, please show by example.

Required Info

  • Visual Studio 2013
  • Windows 10 Pro
  • Google Chrome Version 45.0.2454.101 m 
  • Telerik Product: UI for ASP.NET AJAX, v.2015.3.930.45 (Dev)
  • VB.NET

My HTML

<telerik:RadNavigation runat="server" ID="RadMenu3" Skin="BlackMetroTouch"
    DataSourceID="XmlDataSource1"
    DataTextField="Text"
    DataNavigateUrlField="Url">
</telerik:RadNavigation>
 
 
<asp:XmlDataSource ID="XmlDataSource1" runat="server"    
    DataFile="~/App_Data/SiteNavigation.xml" XPath="/SiteNavigation/Item">
</asp:XmlDataSource>

 

XML SiteNavigation (abbreviated)

<?xml version="1.0" encoding="utf-8" ?>
<SiteNavigation>
  <Item Url="#" Text="Surveying the Past" >
    <Item Url="#" Text="Timeline" />
    <Item Url="#" Text="Blog" />
    <Item Url="#" Text="Discussion" />
  </Item>
  <Item Url="#" Text="Experiencing the Present" >
    <Item Url="#" Text="Timeline" />
    <Item Url="#" Text="Blog" />
    <Item Url="#" Text="Discussion" />
  </Item>
 
</SiteNavigation>

 

ERROR: Page Won't Load

System.Web.UI.WebControls.XmlHierarchyData' does not contain a property with the name 'Url'

 

 

 

Ivan Danchev
Telerik team
 answered on 07 Oct 2015
6 answers
126 views
how I assign a RadButtonToggleState checked or unchecked with javascript
Eric
Top achievements
Rank 1
 answered on 07 Oct 2015
4 answers
133 views
Hello,

I want to use your RadEditor on our corporate page but I have an issue : due to the compatibility issue I need that the tool bar button Bold instead of putting the <strong> tag around my text uses the <b> tag. Its the same for the Italic : I need the <i> tag instead of <em>.

Can those buttons be override to do that ? Or maybe I need to create my own buttons ? Can you give me a code example for this.

Thanks.
Frankie
Top achievements
Rank 1
 answered on 07 Oct 2015
46 answers
1.4K+ views
Hi All,

I use RadScheduler in my application...created resource collection and populated with some data.....but in the drop down by default the first list item is dispalyed as '-' which I dont want. Because if we insert appointment by selecting '-' in the resource type, null value is inserted into the database in that particular cell. So, please let me know how to delete that '-' from the list items.

Thanks
Manikandan
Top achievements
Rank 1
 answered on 07 Oct 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?