Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
495 views

I have a few columns with balances showing on the grid that I export to excel.

I only show the $ sign in the footer totals and the rows are displayed without the $. So my column looks like below:

 

<telerik:GridBoundColumn Aggregate="Sum" DataField="PlanExpense" HeaderText="Annual Plan Expense" UniqueName="PlanExpense"
                            DataFormatString="{0:#,##0.00;(#,##0.00)}" HeaderStyle-Width="9%" FooterAggregateFormatString="{0:c2}" />

protected void grid_ExportCellFormatting(object source, ExportCellFormattingEventArgs e)
{
    if (e.FormattedColumn.ColumnType == "GridTemplateColumn")
    {
        GridTemplateColumn templateCol = (GridTemplateColumn)e.FormattedColumn;
        if (templateCol.DataTypeName == "System.Decimal" || templateCol.DataTypeName == "System.Double")
        {
            e.Cell.Style["mso-number-format"] = "$#,##0.00;($#,##0.00)";
        }
    }
 
    if (e.FormattedColumn.ColumnType == "GridBoundColumn")
    {
        GridBoundColumn boundCol = (GridBoundColumn)e.FormattedColumn;
        if (boundCol.DataFormatString.ToLower().Contains("0:c") || boundCol.DataFormatString.ToLower().Contains("$"))
        {
            //e.Cell.Style["mso-number-format"] = "$#,##0.00;($#,##0.00)";
            e.Cell.Style["mso-number-format"] = "-$* #,##0.00_-;$* (#,##0.00-);_-$* \" - \"??_-;_-@_-";
        }
        else if (boundCol.DataFormatString.ToLower().Contains("%"))
        {
            e.Cell.Style["mso-number-format"] = "0.##%;(0.##%)";
        }
        else if (boundCol.DataFormatString.ToLower().Contains("0:#,##0.00"))
        {
            e.Cell.Style["mso-number-format"] = "0:#,##0.00;(#,##0.00)";
        }
        else if (boundCol.DataFormatString.Contains("{0:P}"))
        {
            e.Cell.Style["mso-number-format"] = @"Percent";
        }
        else if (boundCol.DataFormatString.Contains("{0:#,##0;(#,##0)}"))
        {
            e.Cell.Style["mso-number-format"] = "$#,##0;($#,##0)";
        }
    }
 
 
}

I specify formatting in the exportcellformatting event as shown above, but it seems that is only applicable to the data rows and not the footer. Currently excel displays a negative currency in red parenthesis and I do not want to show the negative in red, only in parentheses.

Is there a way I can format the footer to do that?

 

Tsvetomir
Telerik team
 answered on 08 Oct 2018
1 answer
230 views

Hi,

I'm trying to add a RadButton as checkbox type to toggle "Enabled" and "Disabled" a RadNumericTextBox. Can someone help me please?

 

ASPX Code:

<td>
    <telerik:RadNumericTextBox ID="PAPTestDays" runat="server" DataType="System.Int32" Font-Names="Calibri" Font-Size="9pt" MaxLength="3" Skin="Metro" Width="100px">
        <NegativeStyle Resize="None" />
        <NumberFormat DecimalDigits="0" ZeroPattern="n" />
        <EmptyMessageStyle Resize="None" />
        <ReadOnlyStyle Resize="None" />
        <FocusedStyle Resize="None" />
        <DisabledStyle Resize="None" />
        <InvalidStyle Resize="None" />
        <HoveredStyle Resize="None" />
        <EnabledStyle Resize="None" />
    </telerik:RadNumericTextBox>
    <asp:RangeValidator ID="PAPTestDaysxRangeValidator" runat="server" ControlToValidate="PAPTestDays" ErrorMessage="This value should be between 30 and 365!" Display="Dynamic"
             MaximumValue="365" MinimumValue="30" Type="Integer" ForeColor="Red" Font-Names ="Calibri" Font-Size="9pt">
    </asp:RangeValidator>
    <telerik:RadButton RenderMode="Lightweight" ID="PAPTestDaysEnabled" runat="server" ToggleType="CustomToggle" ButtonType="ToggleButton" AutoPostBack="False" OnClientCheckedChanged="PAPTestDaysEnabled_OnCheckedChanged">
        <ToggleStates>
         <telerik:RadButtonToggleState Text="" PrimaryIconCssClass="rbToggleCheckbox" />
         <telerik:RadButtonToggleState Text="" PrimaryIconCssClass="rbToggleCheckboxChecked" />
        </ToggleStates>
    </telerik:RadButton>
</td>

JavaScript Code:

function PAPTestDaysEnabled_OnCheckedChanged() {
    var checkBox = $find("<%= PAPTestDaysEnabled.ClientID %>");
    var PAPTestDaysTextBox = $find("<%= PAPTestDays.ClientID %>");
    if (checkBox.get_checked()) {
        PAPTestDaysTextBox.enable();
    } else {
        PAPTestDaysTextBox.disable();
    }
}

Rumen
Telerik team
 answered on 08 Oct 2018
4 answers
407 views

Hi,
Is there a way to hide the Save button in asp.net ajax spreadsheet control?

Thanks

Mic

Peter Milchev
Telerik team
 answered on 08 Oct 2018
1 answer
310 views
I am trying to create a dynamic html table generator using ken-do Rad Spreadsheet. I am creating my custom toolbar that works fine but my question is, how can i remove Formula Bar, Column Header, Row Header and cells. I have attach a image, that is actually i am trying to achieve. can someone suggest me how can i do this am new to telerik.
Vessy
Telerik team
 answered on 05 Oct 2018
2 answers
187 views

I'm trying to make a Report Builder in RadEditor, where admin user of our solution can define his own report template, adding some pieces of information as variables, so the other user of less privileges of our system, can just fill the values of these variables, manually or pull from server.

As shown in the attached image, variables are wrapped up with square brackets []. Their names should be retrieved from database.

Please advice how to do that.
Thank you! 

Sumaya
Top achievements
Rank 1
 answered on 05 Oct 2018
3 answers
154 views
Dear all,

In my application I use Radgrid and customized insert window which contains another Radgrid. The grid contains selection column and user can select multiple records. I have a problem when the user selects any records and close the window without saving. It looks list of selected items remains stored somewhere and when I open window again I have a problem. At first look it looks fine but if I click on 'Select All' checkbox nothing happened. I try to debug it JS and I see values in  _selectedItemsInternal property, but it contains old values (which were selected for the first time before window close).

I execute JS function when window is closed. So I hope I can remove any selection in this, but I tested a lot of functions:

grid.clearSelectedItems();
grid.get_masterTableView().set_visible(false);
grid.get_masterTableView().set_dataSource([]);
 
$('[id$="' + grid.ID + '_ClientState"]').val("");
 
masterGrid.get_masterTableView().cancelInsert();


But nothing helps me and when I open it again I have always the same problem. The checkbox 'Select All' doesn't work. When I select records manually one by one then it works.

Do you have any idea what can be wrong with header checkbox or how to clean correctly old values.

Thank you,
Petr
Marin Bratanov
Telerik team
 answered on 05 Oct 2018
3 answers
494 views

Puzzled on how to solve this. Tried the script from this thread:
https://www.telerik.com/forums/marker-tooltip-show-on-load

But I cannot get it working combined with server side binding?

Using the ItemDatabound event then .visible  is not a valid property of the tooltipsetting,
best effort for now is to switch off the autohide

Private Sub RadMap1_ItemDataBound(sender As Object, e As MapItemDataBoundEventArgs) Handles RadMap1.ItemDataBound<br>            CType(e.Item, Telerik.Web.UI.MapMarker).TooltipSettings.AutoHide = False
 End Sub

Any clue  appreciated.

Marin Bratanov
Telerik team
 answered on 05 Oct 2018
1 answer
280 views

I have a RadGrid that I set the cell background colors dynamically based on cell value but none of this formatting carries over to PDF like it does in Excel export.

an someone point me to any sources I can use to program this?

Rumen
Telerik team
 answered on 05 Oct 2018
4 answers
516 views

I have several documents I am importing in order to merge them into one document.  This works find on all of them but one.  On the import statement I get a null reference exception.  I have verified that the stream is not empty.  Does anyone have any clues for a work-around or fix?

var docToBeMerged = new DocxFormatProvider().Import(fileStreamForMergeTarget);

 

Sack Trace:

NullReferenceException: Object reference not set to an instance of an object.

   at Telerik.Windows.Documents.Flow.FormatProviders.Docx.Model.Elements.Document.ParagraphContentElementBase.MoveInlinesToParagraph()
   at Telerik.Windows.Documents.Flow.FormatProviders.Docx.Model.Elements.Document.HyperlinkElement.OnAfterRead(IDocxImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase`3.OnAfterRead(IOpenXmlImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.Read(IOpenXmlReader reader, IOpenXmlImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.ReadChildElements(IOpenXmlReader reader, IOpenXmlImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.Read(IOpenXmlReader reader, IOpenXmlImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.ReadChildElements(IOpenXmlReader reader, IOpenXmlImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.Read(IOpenXmlReader reader, IOpenXmlImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.ReadChildElements(IOpenXmlReader reader, IOpenXmlImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.OpenXmlElementBase.Read(IOpenXmlReader reader, IOpenXmlImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Parts.OpenXmlPartBase.Import(IOpenXmlReader reader, IOpenXmlImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.OpenXmlImporter`1.ImportXlsxPartFromArchive(ZipArchiveEntry zipEntry, OpenXmlPartBase part, IOpenXmlImportContext context)
   at Telerik.Windows.Documents.FormatProviders.OpenXml.OpenXmlImporter`1.Import(Stream input, IOpenXmlImportContext context)
   at Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider.ImportOverride(Stream input)
   at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Import(Stream input)
   at DocumentProcessor.DocumentProcessor.GetPdf(List`1 roles, List`1 restrictedRoles, List`1 files, Boolean includeToc, Boolean includeFooter) in C:\Projects\DocumentProcessor\DocumentProcessor\DocumentProcessor.cs:line 172
   at DocumentProcessor.Default.GetPdfDoc(String role) in C:\Projects\DocumentProcessor\DocumentProcessorHarness\Default.aspx.cs:line 47
   at DocumentProcessor.Default.Test1_OnClick(Object sender, EventArgs e) in C:\Projects\DocumentProcessor\DocumentProcessorHarness\Default.aspx.cs:line 35
   at Telerik.Web.UI.RadButton.OnClick(ButtonClickEventArgs e)
   at Telerik.Web.UI.RadButton.RaisePostBackEvent(String eventArgument)
   at Telerik.Web.UI.RadButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   
   
   

Tanya
Telerik team
 answered on 05 Oct 2018
2 answers
2.4K+ views
Hi, 
    I am using Telerik Rad Grid. I want my first column to be sorted by default in decending order and then by second column. Kindly help me to acomplish this.

Thanks in advance.
konnyaku
Top achievements
Rank 1
 answered on 05 Oct 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?