Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
80 views
Dear Telerik,

Iam trying to export my RadGrid data, it works. But the excelfile has the ".xls" extension. Iam trying to replace the file extension with the next line of code:
Grid1.ExportSettings.Excel.FileExtension = "xlsx"
 
''I want to export to .xml extension to avoid the window for the untrusted resource of the excel ''document.
 
Grid1.ExportSettings.Excel.FileExtension = "xml"

So how can I edit the file extension of the export document?
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
 answered on 02 Dec 2017
6 answers
1.7K+ views
Hi,
I have a webform where on one of the button click, I have to pop up another form, and on that pop up form, whatever user selects, need to add to the parent form grid. Now I am able to update parent page grid by calling parent page code behind function but the problem is that after that function call, the pop up screen is closed even though I dont have any code to close it down.

So simply, on my pop up page, I am storing something on session, on one of its button click, I am calling function to execute parent page's code behind function, ACTUALLY I am calling one of the button's click event. Everything works fine except the Pop up window close down after I call this function and I donot want it to be closed. I want to refresh parent grid and want to keep pop up window open.
Any suggestion ?
Here is my code. Although I copied it almost from telerik samples, please do let me know what changes do I need to make in order to keep the pop up open even after parent page's function is called.

#########################################################################################################
-- SCRIPTS OF PARENT PAGE
  
function OpenPopup(currentVersion) {
            var widthVal = 750;
            var heightVal = 700;
  
            var oWnd = radopen("Components.aspx?v=" + currentVersion, "RadWindow1");
           oWnd.setSize(heightVal, widthVal);
           //set a function to be called when RadWindow is closed
           oWnd.add_close(OnClientClose);
           return false;
     }
  
  
function OnClientClose(oWnd) {
     //get the transferred arguments
     document.getElementById("btnSearchComponent").click();
     }
  
function CalledFn() {
     document.getElementById("btnSearchComponent").click();
     }
  
  
  
     <telerik:RadWindowManager ID="RadWindowManager1" runat="server" 
     ReloadOnShow="true" ShowContentDuringLoad="false" Skin="Default" 
     KeepInScreenBounds ="true" VisibleStatusbar="false" >
     <windows>
     <telerik:RadWindow runat="server" ID="RadWindow1" Width="800" Height="500" Behaviors="Move,Close" 
     Modal="true" NavigateUrl="Components.aspx" AutoSize="false"  
     OnClientClose="OnClientClose" >
     </telerik:RadWindow>
     </windows>                     
     </telerik:RadWindowManager>
  
  
  
ON MY POP UP PAGE ( CHILD PAGE )
  
 <script language="javascript" type="text/javascript">
  
     function CloseForm() {
         window.opener.document.getElementById("btnSearchComponent").click();
     }
 </script>    
  
                <asp:Button runat="server" ID="btnAddProduct" Text="Add" 
                    CssClass="ButtonCSS" onclick="btnAddProduct_Click" Width="350px" />
  
CODE BEHIND TO CALL ABOVE FUNCTION AFTER PERFORMING CERTAIN TASKS AND TO STORE MY VALUES IN SESSION
 protected void btnAddProduct_Click(object sender, EventArgs e)
 {
// I PERFORM CERTAIN TASKS HERE
ClientScript.RegisterClientScriptBlock(this.GetType(), "myscript", @"<script>CloseForm();</script>");
}

#########################################################################################################
Thanks in advance,
Season
Top achievements
Rank 1
 answered on 02 Dec 2017
5 answers
195 views
Hi, I am just starting using Telerik. So, first of all  sorry if I make basic questions. I have been trough video, tutorial and documentation but I am not coming right.
I have a RadGrid with 5 fields. When I click on "add new record", the grid open-up but only 3 of the 5 fields are shown.
The two fields not showing are:
- the CustomerID, which is an  auto-increase identity. I do not need this field to show up because I expect the database to manage it, so this is not the problem;
-the other one is the CustomerName, which is the primary key of the table, this is important to be shown and filled in.
 I do not understand why these two fields do not show, however, how can I make the CustomerName showing up?

Moreover, when I click on "Insert", nothing happen. Is this related to the fact that there are missing fields in the table? Or do I need additional code to post the new records to the database?
Here is the RadGrid code:

    <telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" CellSpacing="0" Culture="it-IT" DataSourceID="SqlDataSource1" GridLines="None">
<MasterTableView AutoGenerateColumns="False" CommandItemDisplay="TopAndBottom" DataKeyNames="CustomerName" DataSourceID="SqlDataSource1">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
    <Columns>
        <telerik:GridBoundColumn DataField="CustomerID" DataType="System.Int32" FilterControlAltText="Filter CustomerID column" HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" UniqueName="CustomerID">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="CustomerName" FilterControlAltText="Filter CustomerName column" HeaderText="CustomerName" ReadOnly="True" SortExpression="CustomerName" UniqueName="CustomerName">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="CustomerContact" FilterControlAltText="Filter CustomerContact column" HeaderText="CustomerContact" SortExpression="CustomerContact" UniqueName="CustomerContact">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Country" FilterControlAltText="Filter Country column" HeaderText="Country" SortExpression="Country" UniqueName="Country">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="date" DataType="System.DateTime" FilterControlAltText="Filter date column" HeaderText="date" SortExpression="date" UniqueName="date">
        </telerik:GridBoundColumn>
    </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
Some help will be appreciated. Thanks.
Matt
Top achievements
Rank 1
 answered on 01 Dec 2017
0 answers
70 views

Hi ,

     I am trying to create drop down inline in the kendo grid and i cannot bind the data. can you please let me know where i did wrong.

    dsPartnerGrid = new kendo.data.DataSource({
        serverFiltering: true,
        serverPaging: true,
        serverSorting: true,
        autoBind: false,
        batch: false,
        autoSync: true,
        pageSize: 30,
        schema: {
            model: {
                id: "MPN_ID",
                fields: {
                    "MPN_ID": { type: "string", editable: true, validation: { required: true } },

                }
            }
        },
        type: "odata",
        transport: {

            read: {
                url: $.appConfig.ServiceUri + "/SAMGPLs",
                dataType: "jsonp"
            }

        },
        requestEnd: function (e) {

            if (typeof (e.response) == 'undefined')
                return;
            if (e.response == null)
                return;
            if (typeof (e.response.d) == 'undefined')
                return;
            if (e.response.d.length == 0)
                return;
        }

    })




    $("#partnerGrid").kendoGrid({
        dataSource: dsPartnerGrid,
        pageable: true,
        height: 550,
        //filterable: {
        //    mode: "row"
        //},
        toolbar: ["create"],
        columns: [
            { command: ["edit", "destroy"], title: "&nbsp;", width: "150px" },
            { field: "MPN_ID", title: "MPN_ID", width: "150px", editor: mpnDropDownEditor, template: "#=Mpn.MPN_ID#"},

        ],

        editable: "inline"
    });

Karteek
Top achievements
Rank 1
 asked on 01 Dec 2017
1 answer
75 views

I'm trying to create a master/detail page for an Accounts table in our database.  Our Accounts table has a few hundred fields in it, so the master grid should only show a short summary of a few pertinent fields for the user to identify which account they want to look at in detail.  I would also like to display fields from a few joined tables in the master grid as well.

We are using an Web API & OData source.  Instead of creating new endpoints to return the summary data I need, can we utilize the OData $select & $expand options with the Grid?

I might be missing something simple here, but if you have any suggestions or tutorials, I would appreciate it.

 

Marin Bratanov
Telerik team
 answered on 01 Dec 2017
4 answers
1.3K+ views

Hi,

 I have a RadGrid. I would like to export it to excel and I would like to use the .xlsx format (ie: radGrid.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx). However, some columns have numerical names like 1234 or 01300 and I would like those particular columns to show up in the excel spreadsheet as a Text format - so 1.) 1234 would be left aligned in the cell just like any text and 2.) so that leading zeros aren't automatically removed. 

 I've tried many solutions from this forum - but all of them seem to only work in GridExcelExportFormat.Html format (like using the OnExporttoExcel event) or other grid formats like ExcelIML (ie. setting the DataFormatString attribute to contain a leading space =&nbsp;{0}).

 I want to export to .xlsx format to avoid warnings and because .xlsx has been around for a long time now, and I'd like my software to export to a modern commonly used format. 

Is there any solutions for this problem when using GridExcelExportFormat.Xlsx format?

See the attached images for the code.

 Here is the code:

<telerik:RadGrid AutoGenerateColumns="false" ID="rgrBoundaryDefinitionList"      OnNeedDataSource="rgrBoundaryDefinitionList_NeedDataSource"     AllowFilteringByColumn="True" AllowSorting="True" Width="100%"     ShowFooter="True" AllowPaging="True" PageSize="1000"      runat="server"      OnItemCommand="rgrBoundaryDefinitionList_ItemCommand"     OnPreRender="rgrBoundaryDefinitionList_OnPreRender"       EnableLinqExpressions="False">     <GroupingSettings CaseSensitive="false"></GroupingSettings>        <ClientSettings>           <Scrolling AllowScroll="True" UseStaticHeaders="True"/>         </ClientSettings>     <MasterTableView ShowHeadersWhenNoRecords="true" AutoGenerateColumns="false" AllowFilteringByColumn="True" ShowFooter="True"          DataKeyNames="ClientId, BoundarySetId, Name, ClientName, ClientType, KeyFileName" NoMasterRecordsText="No Results" EnableColumnsViewState="True">         <SortExpressions>             <telerik:GridSortExpression FieldName="Name" SortOrder="Ascending" />         </SortExpressions>         <Columns>             <telerik:GridTemplateColumn UniqueName="BoundarySetDetailsColumn" AllowFiltering="true"  HeaderStyle-Width="70px">                <FilterTemplate>                     <asp:ImageButton ID="btnClearFilters" runat="server" ImageUrl="~/Images/clearfilter.png" AlternateText="Clear Filters"                     ToolTip="Clear Filters" OnClick="btnClearFilters_Click" Style="vertical-align: middle; " />                </FilterTemplate>                 <ItemTemplate>                     <telerik:RadButton ID="btnBoundarySetDetails" runat="server" Text="Details" CommandName="Details" />                 </ItemTemplate>             </telerik:GridTemplateColumn>             <telerik:GridBoundColumn FilterControlWidth="120px" DataField="Name"  HeaderText="Boundary Name" DataFormatString=""                 AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="150px" />             <telerik:GridBoundColumn FilterControlWidth="150px" DataField="ClientName"  HeaderText="Organization Name"                 AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="150px" />             <telerik:GridBoundColumn DataField="ClientType"   HeaderText="Organization Type"                   AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo" ShowFilterIcon="false" HeaderStyle-Width="100px" />             <telerik:GridCheckBoxColumn DataField="IsUsingKeyFile" HeaderText="Keyfile" HeaderStyle-Width="50px"                 AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" ConvertEmptyStringToNull="False" UniqueName="IsUsingKeyFile">                 <FilterTemplate>                     <telerik:RadComboBox ID="rcboFilterIsKey" runat="server" AllowCustomText="False "                         SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("IsUsingKeyFile").CurrentFilterValue %>'                         OnClientSelectedIndexChanged="IsKeyFileChanged" Width="40px" ViewStateMode="Disabled">                     <Items>                         <telerik:RadComboBoxItem Text="All" Value="" />                         <telerik:RadComboBoxItem Text="Yes" Value="True" />                         <telerik:RadComboBoxItem Text="No" Value="False" />                     </Items>                     </telerik:RadComboBox>                     <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">                     <script type="text/javascript">                         function IsKeyFileChanged(sender, args) {                             var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");                             var filterVal = args.get_item().get_value();                             if (filterVal==null  || filterVal == "") {                                 tableView.filter("IsUsingKeyFile", "", "NoFilter");                             }                             else  {                                 tableView.filter("IsUsingKeyFile", filterVal, "EqualTo");                             }                         }                     </script>                   </telerik:RadScriptBlock>                 </FilterTemplate>             </telerik:GridCheckBoxColumn>             <telerik:GridBoundColumn DataField="KeyFileName" Display="false" HeaderText="Keyfile Name" HeaderStyle-Width="200px" />             <telerik:GridBoundColumn DataField="Description" HeaderText="Description"                   AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="150px" />             <telerik:GridCheckBoxColumn DataField="ClientDefault" HeaderText="Default" HeaderStyle-Width="50px"                 AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" ConvertEmptyStringToNull="False" UniqueName="ClientDefault">                 <FilterTemplate>                     <telerik:RadComboBox ID="rcboFilterDefault" runat="server" AllowCustomText="False "                         SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ClientDefault").CurrentFilterValue %>'                         OnClientSelectedIndexChanged="IsDefaultChanged" Width="40px" ViewStateMode="Disabled">                     <Items>                         <telerik:RadComboBoxItem Text="All" Value="" />                         <telerik:RadComboBoxItem Text="Yes" Value="True" />                         <telerik:RadComboBoxItem Text="No" Value="False" />                     </Items>                     </telerik:RadComboBox>                     <telerik:RadScriptBlock ID="rsbDefaultScriptBlock" runat="server">                     <script type="text/javascript">                         function IsDefaultChanged(sender, args) {                             var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");                             var filterVal = args.get_item().get_value();                             if (filterVal == null || filterVal == "") {                                 tableView.filter("ClientDefault", "", "NoFilter");                             }                             else {                                 tableView.filter("ClientDefault", filterVal, "EqualTo");                             }                         }                     </script>                   </telerik:RadScriptBlock>                 </FilterTemplate>             </telerik:GridCheckBoxColumn>             <telerik:GridBoundColumn DataField="Status" HeaderText="Status" UniqueName="Status" DataType="System.String" HeaderStyle-Width="100px" FilterControlWidth="60px" />         </Columns>       </MasterTableView></telerik:RadGrid>

 

 

And the code from the code behind for the export button handler:

protected void rbtnExport_Click(object sender, EventArgs e) {     

rgrBoundaryDefinitionList.MasterTableView.GetColumn("KeyFileName").Display = true;

rgrBoundaryDefinitionList.MasterTableView.GetColumn("BoundarySetDetailsColumn").Display = false;    rgrBoundaryDefinitionList.MasterTableView.GetColumn("ClientType").HeaderStyle.Width = Unit.Pixel(200);    rgrBoundaryDefinitionList.MasterTableView.GetColumn("Description").HeaderStyle.Width = Unit.Pixel(500);   

rgrBoundaryDefinitionList.ExportSettings.OpenInNewWindow = true;

rgrBoundaryDefinitionList.ExportSettings.ExportOnlyData = false;

rgrBoundaryDefinitionList.ExportSettings.HideStructureColumns = true;

rgrBoundaryDefinitionList.ExportSettings.IgnorePaging = true;

rgrBoundaryDefinitionList.ExportSettings.FileName = fileName;

rgrBoundaryDefinitionList.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;

rgrBoundaryDefinitionList.MasterTableView.ExportToExcel();

} 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Peter Milchev
Telerik team
 answered on 01 Dec 2017
1 answer
119 views

My Treelist is not displaying any records. I've verified that the data source works, because it's displaying in a standard grid.

The documentation states the following:

If the key fields are of value type or string, the root items are either:

  • items with ParentKeyValue set to the default value of the type
  • items for which the parent key value is equal to the key value

In my datasource record ID 14 has a parentID 14 indicating it's a root item. Why is this not working in my treeList? Am I misunderstanding the documentation?

Eyup
Telerik team
 answered on 01 Dec 2017
1 answer
213 views

Hello!  I would like to require the user to fill in a textbox before they can select a file for upload.  Is there a javascript event that is fired on the click event of the select input? I want to prevent the file dialog from opening.  

Thank you!

 

<telerik:RadAsyncUpload ID="fuMediaUpload" runat="server" AllowedFileExtensions=".MOV,.mp4,.wmv,.avi,.mpeg,.mpg,.mp3,.aac,.m4a"
                       EnableInlineProgress="true" MaxFileInputsCount="1" ControlObjectsVisibility="None" DisableChunkUpload="false"  Skin="Bootstrap"
                       MaxFileSize="629145600" ChunkSize="10485760" OverwriteExistingFiles="true" RenderMode="Lightweight" HideFileInput="true" localization-select="Select Media File"
                       OnClientFileUploadRemoved="OnClientFileUploadRemoved" OnClientFileUploaded="OnClientFileUploaded"  EnableViewState="true"  >
                   </telerik:RadAsyncUpload>

 

Peter Milchev
Telerik team
 answered on 01 Dec 2017
0 answers
110 views

Hi,

Im trying to create an xlsx Output with the XlsxRenderer from Telerik.Web.UI.ExportInfrastructure. When having only one Worksheet/Table everythings fine. But after adding a second worksheet with ExportStructure.Tables.Add Function, when rendering the output in the resulting xlsx file the first sheet gets overwritten with the data from the second sheet.

 

When i use the XlsBiffRenderer with exactly the same structure everything works fine, so i dont know if this is a bug or im doing anything wrong.

 

We are using version 2016.1 of the telerik controls.

 

Regards Alex

Alex
Top achievements
Rank 1
 asked on 01 Dec 2017
1 answer
114 views

Bit of a weird issue here. It happens when pasting any drawing object that contains text from Word into the editor.

In IE, the drawing object is converted to a base 64 string. In Chrome and Firefox, the image src is a temporary file location found in the user's AppData (file:///C:\Users\USERNAME~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png for example).

This is not an issue if you copy & paste an image or a simple shape or group of shapes from Word in any browser - all are consistently converted to a base 64 string. It only happens if you copy & paste a drawing object that contains text.

See Single Shape.docx. Copy and pasting the content into the Editor in any browser, all convert as expected.

See also Shape With Text.docx. Copy and paste converts to base 64 in IE as expected, although it looks little strange due to loss of font styles. Paste its content into Chrome or Firefox, though, and it will not convert. Instead, it is a reference to a temporary local file.

Is there any workaround to convert these objects consistently in Chrome and IE?

Rumen
Telerik team
 answered on 01 Dec 2017
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?