Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
146 views

Hello,

I have a RadGrid with GridNumericColumn and EditMode="Batch"

Here is column definition

<telerik:GridNumericColumn DataField="CheckAmount"  UniqueName="CheckAmount" HeaderText="Check Amount ($)" DataFormatString="{0:C2}" DecimalDigits="2" NumericType="Number" ColumnEditorID="NumericEditor" ItemStyle-HorizontalAlign="Right"></telerik:GridNumericColumn> 

Here is column editor definition

<telerik:GridNumericColumnEditor runat="server" ID="NumericEditor"> 
<NumericTextBox runat="server" NumberFormat-DecimalDigits="2" DataFormatString="{0:C2}" NumberFormat-GroupSeparator="" MinValue="0.00" MaxValue="99999999.99" IncrementSettings-InterceptArrowKeys="false" IncrementSettings-InterceptMouseWheel="false"></NumericTextBox>
</telerik:GridNumericColumnEditor>

Currently, when I edit a number two zeroes are automatically added after a decimal point, for example,  1234 gets converted to 1234.00.  I would like to implement functionality when user can type in "cents" and amount gets converted to "dollars.cents", for example 1234 should be converted to 12.34.  Could you please suggest how to implement it?

And to expand my original question, I also need to deny entering of empty and negative amounts preferably with validation messages instead of out of range auto correct.  Is it possible to achieve with GridNumericColumn/GridNumericColumnEditor or do I need to use GridTempateColumn with EditItemTemplate? 

Thanks,

Olga

Doncho
Telerik team
 answered on 19 Jul 2022
0 answers
912 views

Hello

I have a asp:button with event "onClientClick" calling radAlert. The idea being if no checkbox from a list is selected, then I show error message saying no checkbox selected. If something is checked, then I show an alert warning side effects of performing this action to users.

Using normal windows alert my code worked fine. I changed it to radAlert and I get the following error when button click method returns true. any ideas why? Thanks

Please note I have included script manager tag in site master and noticed that skinManager made no difference.

Telerik.Web.UI is version 2020.3.915.45

error:

Uncaught TypeError: Cannot read properties of null (reading 'click')
    at Sys.UI.DomEvent._removeHandler (ScriptResource.axd?d=l-HRKS2UdUh-FV8pLZQt_8PO1KoV-nv3gFy0dGRtji95LKfVBi92Y5fapUBBxhFsoFd78m3hPynnuWeinQLEFSTurV2yHCVYQ4Yb8UUeyxc0W4nob0uNxUaSqn5y-HKGhZWdur9WRfeM3AuWWX3uN_SRx5d9J5ymT9svRP3TrhY1&t=49337fe8:5:58766)
    at Sys.UI.DomEvent.removeHandler (ScriptResource.axd?d=l-HRKS2UdUh-FV8pLZQt_8PO1KoV-nv3gFy0dGRtji95LKfVBi92Y5fapUBBxhFsoFd78m3hPynnuWeinQLEFSTurV2yHCVYQ4Yb8UUeyxc0W4nob0uNxUaSqn5y-HKGhZWdur9WRfeM3AuWWX3uN_SRx5d9J5ymT9svRP3TrhY1&t=49337fe8:5:58674)
    at ......

my code:

The asp:button looks like this:

                              <asp:Button Text="Baseline Permissions" runat="server" ID="btnRemapTitlesToRoles" OnClientClick="return hasTitlesSelectedForRemap();" OnClick="btnRemapTitlesToRoles_Click" CssClass="btn" /> 
the code that's called looks like this:

 <script type="text/javascript">

        (function (global, undefined) {
            var demo = {};

            global.$dialogsDemo = demo;

            Sys.Application.add_load(function () {
                //attach a handler to radio buttons to update global variable holding image url
                $telerik.$('input:radio').bind('click', function () {
                    demo.imgUrl = $telerik.$(this).val();
                });
            });

            global.alertCallBackFn = alertCallBackFn;

            function alertCallBackFn(arg) {
                // empty place holders
                return true;
            }
        })(window);
// this is the method called by asp:button
        function hasTitlesSelectedForRemap() {
            var isAnyTitleChecked = $('#' + '<%= titlesGridView.ClientID %>' + ' input:checkbox').is(":checked");
            var message = '';
            var title = '';
            if (!isAnyTitleChecked) {
                message = 'Please select titles first';
                title = 'selection missing';
            }
            else {
                message = 'Baselining permissions will reset permissions for all users of selected titles. Please proceed with caution.';
                title = 'Remap warning';
            }
            radalert(message, 330, 180, title, alertCallBackFn, $dialogsDemo.imgUrl);

            return isAnyTitleChecked;
        }

        function selectAllRolesForTitles(sender) {
            var isChecked = sender.checked;
            $('#' + '<%= titlesGridView.ClientID %>' + ' input:checkbox').each(function () {
                $(this).prop("checked", isChecked);
            });
        }

        
    </script>

 

Josh
Top achievements
Rank 1
 asked on 16 Jul 2022
1 answer
175 views
<%@ Page Language="C#" Title="Manage City Records" AutoEventWireup="true" CodeFile="Cities.aspx.cs" MasterPageFile="~/MasterPage.master" Inherits="admin_Cities" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Main1" runat="Server">

    <telerik:RadWindowManager RenderMode="Lightweight" runat="server" ID="RadWindowManager1"></telerik:RadWindowManager>
    <script type="text/javascript">

        function alertCallBackFn(arg) {
            //console.log(arg);


        }

    </script>

    <!-- PAGE HEADER -->
    <div class="container-fluid page-header-container">
        <div class="row page-header-row">
            <div class="col page-header-col-left">
                <h1>Manage City Records</h1>
            </div>
        </div>
    </div>
    <!-- / PAGE HEADER -->

    <div class="dataList">
        <div class="container-fluid">
            <div class="row">
                <div class="col">
                    <form id="form1">
                        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                        </telerik:RadAjaxManager>
                        <div id="demo" class="demo-container no-bg">
                            <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" ShowStatusBar="true"
                                AutoGenerateColumns="False" PageSize="10" AllowSorting="True" AllowMultiRowSelection="False"
                                AllowPaging="True" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
                                AllowAutomaticUpdates="True" OnItemUpdated="RadGrid1_ItemUpdated" OnItemDeleted="RadGrid1_ItemDeleted"
                                OnItemInserted="RadGrid1_ItemInserted" OnInsertCommand="RadGrid1_InsertCommand"
                                OnItemCreated="RadGrid1_ItemCreated" OnPageIndexChanged="RadGrid1_PageIndexChanged" OnLoad="RadGrid1_Load">
                                <PagerStyle Mode="NumericPages"></PagerStyle>
                                <MasterTableView DataSourceID="SqlDataSource1" PageSize="10" DataKeyNames="ID" Width="100%" CommandItemDisplay="Top" Name="City">
                                    <DetailTables>
                                        <telerik:GridTableView DataKeyNames="ID" DataSourceID="SqlDataSource2" Width="100%"
                                            runat="server" CommandItemDisplay="Top" Name="CityLookup">
                                            <ParentTableRelation>
                                                <telerik:GridRelationFields DetailKeyField="CityID" MasterKeyField="ID"></telerik:GridRelationFields>
                                            </ParentTableRelation>
                                            <Columns>
                                                <telerik:GridEditCommandColumn UniqueName="EditCommandColumn2">
                                                    <HeaderStyle Width="20px"></HeaderStyle>
                                                    <ItemStyle CssClass="MyImageButton"></ItemStyle>
                                                </telerik:GridEditCommandColumn>
                                                <telerik:GridBoundColumn SortExpression="ID" HeaderText="ID" HeaderButtonType="TextButton"
                                                    DataField="ID" UniqueName="ID" ReadOnly="true">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn SortExpression="re_city_id" HeaderText="City ID" HeaderButtonType="TextButton"
                                                    DataField="re_city_id" UniqueName="CityID" ReadOnly="true">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn SortExpression="OriginalCity" HeaderText="Original City" HeaderButtonType="TextButton"
                                                    DataField="OriginalCity" UniqueName="OriginalCity">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn SortExpression="OriginalStprov" HeaderText="Original State/Province"
                                                    HeaderButtonType="TextButton" DataField="OriginalStprov" UniqueName="OriginalStprov">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn SortExpression="OriginalCountry" HeaderText="Original Country" HeaderButtonType="TextButton"
                                                    DataField="OriginalCountry" UniqueName="OriginalCountry">
                                                </telerik:GridBoundColumn>
                                                 <telerik:GridCheckBoxColumn  HeaderText="Enable Correction" HeaderButtonType="TextButton"
                                                    DataField="EnableCorrection" UniqueName="EnableChildCorrection" DataType="System.Boolean" >
                                                </telerik:GridCheckBoxColumn>
                                                <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this record from re_citylookup?"
                                                    CommandName="Delete" Text="Delete" UniqueName="DeleteColumn2">
                                                    <HeaderStyle Width="20px"></HeaderStyle>
                                                    <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                                                </telerik:GridButtonColumn>
                                            </Columns>
                                            <SortExpressions>
                                                <telerik:GridSortExpression FieldName="OriginalCity"></telerik:GridSortExpression>
                                            </SortExpressions>
                                        </telerik:GridTableView>
                                    </DetailTables>
                                    <Columns>
                                        <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
                                            <HeaderStyle Width="20px"></HeaderStyle>
                                            <ItemStyle CssClass="MyImageButton"></ItemStyle>
                                        </telerik:GridEditCommandColumn>
                                        <telerik:GridBoundColumn SortExpression="ID" HeaderText="ID" HeaderButtonType="TextButton"
                                            DataField="ID" UniqueName="ID" ReadOnly="true">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn SortExpression="City" HeaderText="City" HeaderButtonType="TextButton"
                                            DataField="City" UniqueName="City">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn SortExpression="State" HeaderText="State" HeaderButtonType="TextButton"
                                            DataField="State" UniqueName="State">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn SortExpression="Country" HeaderText="Country" HeaderButtonType="TextButton"
                                            DataField="Country" UniqueName="Country">
                                        </telerik:GridBoundColumn>
                                          <telerik:GridCheckBoxColumn  HeaderText="Enable Correction" HeaderButtonType="TextButton"
                                                    DataField="EnableCorrection" UniqueName="EnableCorrection" DataType="System.Boolean">
                                                </telerik:GridCheckBoxColumn>
                                        <telerik:GridButtonColumn ConfirmText="Deleting this record from re_city will also remove child records from re_citylookup table. Are you sure you want to delete this?"
                                            CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                                            <HeaderStyle Width="20px"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                                        </telerik:GridButtonColumn>
                                    </Columns>
                                    <SortExpressions>
                                        <telerik:GridSortExpression FieldName="City"></telerik:GridSortExpression>
                                    </SortExpressions>
                                </MasterTableView>
                            </telerik:RadGrid>
                        </div>
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                            DeleteCommand="DELETE FROM [dbo].[re_citylookup] WHERE [re_city_id] = @ID; DELETE FROM [dbo].[re_city] WHERE [ID] = @ID"
                            InsertCommand="IF(((SELECT COUNT(1) FROM [dbo].[re_city] WHERE [City] = @City AND [State] = @State AND [Country] = @Country) = 0) AND ((SELECT COUNT(1) FROM [dbo].[re_citylookup] WHERE [OriginalCity] = @City AND [OriginalStprov] = @State AND [OriginalCountry] = @Country) = 0)) BEGIN INSERT INTO [dbo].[re_city] ([City], [State], [Country]) VALUES (@City, @State, @Country); INSERT INTO [dbo].[re_citylookup]([re_city_id], [OriginalCity], [OriginalStprov], [OriginalCountry]) SELECT TOP 1 ID, @City, @State, @Country FROM [dbo].[re_city] WHERE [City] = @City AND [State] = @State AND [Country] = @Country ORDER BY ID DESC; END; ELSE BEGIN THROW 99001, 'City Already Exists', 1; END;"
                            SelectCommand="SELECT * FROM [dbo].[re_city]"
                            UpdateCommand="UPDATE [dbo].[re_city] SET [City] = @City, [State] = @State, [Country] = @Country WHERE [ID] = @ID">
                            <DeleteParameters>
                                <asp:Parameter Name="ID" Type="Int32"></asp:Parameter>
                            </DeleteParameters>
                            <InsertParameters>
                                <asp:Parameter Name="City" Type="String"></asp:Parameter>
                                <asp:Parameter Name="State" Type="String"></asp:Parameter>
                                <asp:Parameter Name="Country" Type="String"></asp:Parameter>
                            </InsertParameters>
                            <UpdateParameters>
                                <asp:Parameter Name="City" Type="String"></asp:Parameter>
                                <asp:Parameter Name="State" Type="String"></asp:Parameter>
                                <asp:Parameter Name="Country" Type="String"></asp:Parameter>
                                <asp:Parameter Name="ID" Type="Int32"></asp:Parameter>
                               
                            </UpdateParameters>
                        </asp:SqlDataSource>
                        <asp:SqlDataSource ID="SqlDataSource2" runat="server"
                            DeleteCommand="DELETE FROM [dbo].[re_citylookup] WHERE [ID] = @ID"
                            InsertCommand="IF((SELECT COUNT(1) FROM [dbo].[re_citylookup] WHERE [OriginalCity] = @OriginalCity AND [OriginalStprov] = @OriginalStprov AND [OriginalCountry] = @OriginalCountry) = 0) BEGIN INSERT INTO [dbo].[re_citylookup] ([re_city_id], [OriginalCity], [OriginalStprov], [OriginalCountry]) VALUES (@CityID, @OriginalCity, @OriginalStprov, @OriginalCountry) END ELSE BEGIN THROW 99001, 'City Already Exists', 1; END"
                            SelectCommand="SELECT [ID], [re_city_id], [OriginalCity], [OriginalStprov], [OriginalCountry],[EnableCorrection] FROM [dbo].[re_citylookup] WHERE [re_city_id] = @CityID"
                            UpdateCommand="UPDATE [dbo].[re_citylookup] SET [OriginalCity] = @OriginalCity, [OriginalStprov] = @OriginalStprov, [OriginalCountry] = @OriginalCountry WHERE [ID] = @ID">
                            <SelectParameters>
                                <asp:Parameter Name="CityID" Type="Int32"></asp:Parameter>
                            </SelectParameters>
                            <DeleteParameters>
                                <asp:Parameter Name="ID" Type="Int32"></asp:Parameter>
                            </DeleteParameters>
                            <InsertParameters>
                                <asp:Parameter Name="CityID" Type="Int32"></asp:Parameter>
                                <asp:Parameter Name="OriginalCity" Type="String"></asp:Parameter>
                                <asp:Parameter Name="OriginalStprov" Type="String"></asp:Parameter>
                                <asp:Parameter Name="OriginalCountry" Type="String"></asp:Parameter>
                            </InsertParameters>
                            <UpdateParameters>
                                <asp:Parameter Name="OriginalCity" Type="String"></asp:Parameter>
                                <asp:Parameter Name="OriginalStprov" Type="String"></asp:Parameter>
                                <asp:Parameter Name="OriginalCountry" Type="String"></asp:Parameter>
                                <asp:Parameter Name="ID" Type="Int32"></asp:Parameter>
                            </UpdateParameters>
                        </asp:SqlDataSource>
                    </form>
                </div>
            </div>
        </div>
    </div>

</asp:Content>
Doncho
Telerik team
 answered on 12 Jul 2022
0 answers
99 views

 

 

<radCLB:CallbackDropDownList runat="server" ID="OrgPropertyStateList" Width="209px"       OnSelectedIndexChanged="OrgPropertyStateList_SelectedIndexChanged" AutoPostBack="True"                         ControlsToUpdate="pnlSearches;EmploymentTypeSection;divApplicantSalarySelection;divPropertyCitySelection;divPropertyCountySelection" ClientEvents-OnRequestSent="ValidateDateOfBirthAllowedForState">
<asp:ListItem>Unbound</asp:ListItem>
</radCLB:CallbackDropDownList>
Alex
Top achievements
Rank 1
 asked on 11 Jul 2022
2 answers
250 views

Hi, I'm trying to put focus on filter input in DropdownTree control when dropdown is opened but I can't get it. I've tryed with some code like this but without success:

 

JS:
            function SetFilterFocus(sender,argEvent){
                sender.get_filterElement().focus();
            }

ASP.NET
                                            <telerik:RadDropDownTree CssClass="RadComboBox_Metro" Skin="Metro" runat="server" ID="ddt_centro" AutoPostBack="true" Width="90%" TabIndex="3" DataTextField="FMODES" DataFieldID="FMOFAM" TextMode="Default" DataFieldParentID="FMOZU1" OnClientEntryAdding="OnClientEntryAdding" ExpandNodeOnSingleClick="true" CheckNodeOnClick="true" EnableFiltering="true" OnClientDropDownOpened="SetFilterFocus">
                                                <FilterSettings Filter="Contains" Highlight="Matches" MinFilterLength="3" />
                                                <DropDownSettings CssClass="RadComboBox_Metro" Height="300px" CloseDropDownOnSelection="true" />
                                            </telerik:RadDropDownTree>

 

 

Is it possible to do this?

 

Thanks

David
Top achievements
Rank 1
Iron
 answered on 08 Jul 2022
1 answer
97 views

How can i make a popup on a layer click with information (name,etc...).

On Telerik Radmap Asp.net

 

Attila Antal
Telerik team
 answered on 04 Jul 2022
0 answers
104 views

Hey all, l was wondering how I would go about removing these huge gaps on my <li> upon export.  I'm placing dynamic values from state. I attached the before and after images.

 

<ol className="contract-details-one">
<li>
Event Date:
<strong className="field-highlight"> {eventDate}</strong>

</li>

</ol>

Vaughn
Top achievements
Rank 1
 asked on 01 Jul 2022
2 answers
218 views

If I attempt to ajaxify an asp.net textbox using RadAjaxManager, obviously, a div with a RadAjaxPanel class surround the div with the "form-floating" class.

When that situation occurs the placeholder duplicates 11px above the current one. In addition, when you put the cursor in the textbox field, the floating label doesn't "float". It remains where it is and conflicts with the newly entered text in the textbox.

 

Any suggestions?

Dana

Dana Cobb
Top achievements
Rank 1
Iron
 answered on 29 Jun 2022
1 answer
404 views

I have a grid.  It has a MasterTableView and a DetailTables with a GridTableView that has a CommandItemTemplate.  In the DetailTableDataBind event I need to hide a button when certain conditions apply.  I can't for the life of me figure out how to access these buttons.  I can get to the buttons in the MasterTableView's CommandItemTemplate, but not the Detail Table. 

Anyone know how to access these little buggers?  VB.NET if at all possible...please and thank you.  if you need for me to post my grid structure I can.  

Attila Antal
Telerik team
 answered on 29 Jun 2022
1 answer
122 views

Hi Team,

As I am trying use Radalert box to show the validation messages from javascript function. (Earlier we were using normal alert for validation messages).

I am able to get the radalert pop up but unable to see the messages on it as its blank box.

Please advise me on this.

Thanks in Advance

Vijaykumar

 

Code :

 

if (grid.get_masterTableView().get_selectedItems()[0] != undefined) {
        selRequestRowID = grid.get_masterTableView().getCellByColumnUniqueName(grid.get_masterTableView().get_selectedItems()[0], 'REQUESTINFO_ID').innerHTML;
    } else if (!all) {
        //alert(alertNothingSelected);
        radalert("Please select a record", 290, 220, "Alert"); //this is the message want show it on UI
        return false;
    }

 

As I can see it in debugger mode the line is executing without any error and even I can see the pop up box with my css .

 

Peter Milchev
Telerik team
 answered on 29 Jun 2022
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
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
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?