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

Hi everybody,

I have two RadNumericTextBox which represent initial and final values. I added two js functions, one goes for ini and the other goes for fin. These check values entered by user to verify that initial value is minor or equal to final value and viceversa.

The issue with my code is that ini value isnot being set when I call ini.set_value(fin.get_value()). It will only work if I enter (for the second time) a new bigger initial value (initial value cannot be bigger than final value).

I already debugged the js and it works fine but it has to be executed twice in order to see the corrected value at initial RadNumericTextBox.

Here is the RadNumericTextBox declaration

1.<telerik:RadNumericTextBox ID="TextInicio" runat="server" Value="0" DataType="System.Int32" MinValue="1">
2.   <NegativeStyle Resize="None"></NegativeStyle>
3.   <NumberFormat ZeroPattern="n" DecimalDigits="0"></NumberFormat>
4.   <ClientEvents OnValueChanging="VerificarValorInicio" />
5.</telerik:RadNumericTextBox>

 

And the javascript function

01.function VerificarValorInicio(sender,args)
02.{
03.   var txtIni = $find("<%=TextInicio.ClientID%>");
04.   var ini = txtIni.get_value();
05.   var txtFin = $find("<%=TextFin.ClientID%>");
06.   var fin    = txtFin.get_value();
07. 
08.// If user entered an ini value bigger than fin value (which is not allowed)
09.   if (ini > fin) {
10.       txtIni.set_value(fin); // txtIni won´t show the value passed by fin variable
11.   }
12.}

 

Any ideas about this??

Thanks in advance

 

Peter Milchev
Telerik team
 answered on 17 May 2018
4 answers
1.3K+ views

Hi,

We have a vertically scrolled DIV and we want to export the whole DIV in PDF, we are using ClientExportManger exportPDF, but the only visible part of DIV exported in PDF while we need to export complete DIV in multiple PDF pages. Snapshot attached with a red highlighted scrollbar. How we achieve that goal? Any small sample application would be helpful.

Marin Bratanov
Telerik team
 answered on 17 May 2018
7 answers
530 views
Hi,

I have one user control which contains radtabstrip. For this I set ContentUrl property of RadPageView to one of the aspx page. This user control I placed in another aspx page. Now I want to access control & client side method of parent page(aspx) from my child page(RadPageView contenturl page). It is urgent. 

Thanks 
Vijesh
David
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 17 May 2018
0 answers
130 views

I have a RadDateTimePicker in a grid, which is in edit mode.  In a certain scenario, I want to clear the value that was selected in the RadDateTimePicker via javascript.

However, when I do a "find", or a "get", or "document.getElementById", I cannot find my object.  Any ideas?

I have tried with ClientIdMode not set and with it =AutoId

var myElement = $find("<%=Time.ClientID %>");      --object reference not set to an instance of an object

<EditFormSettings EditFormType="Template">
    <FormTemplate>
        <table width="100%" OnKeyPress="return disableEnterKey(event)">
            <tr>
                <td>
                    <div class="myClass1">
                        <span class="label" id="Span1">
                            junk
                        </span>
                        <span class="myClass2 id="Span2">
                            <telerik:RadDateTimePicker ID="Time" runat="server"  />
                        </span>
Stacy
Top achievements
Rank 1
 asked on 17 May 2018
0 answers
193 views

I am trying to get a dynamic RadWindow to display the loading icon. When I create the window declaratively or even programatically and add it to the RadWindowManager, the loading icon displays. But when I have instances where I am launching windows using the code below, the window displays with content (eventually), but while the content loads, I get a blank white screen. Is there a way to have the RadWindow display the loading icon if the window doesn't exist until it is launched?

01.function OpenDynamicWindow(title, url, width, height, closeArgument) {
02.    var win = radopen(url, null, width, height, 0, 0);
03.    win.set_title(title);
04.    win.set_iconUrl(window.location.origin + '/cws/images/cws_icon.ico');
05.    win.set_behaviors(Telerik.Web.UI.WindowBehaviors.Reload + Telerik.Web.UI.WindowBehaviors.Maximize + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Resize + Telerik.Web.UI.WindowBehaviors.Close);
06.    win.set_showContentDuringLoad(false);
07.    win.set_reloadOnShow(true);
08.    win.argument = closeArgument;
09.    win.add_close(CloseDynamicWindow);
10.}
11. 
12.function CloseDynamicWindow(sender, eventArgs) {
13.    $find('<%= ramPopWindow.ClientID%>').ajaxRequest(sender.argument);
14.}
Randy
Top achievements
Rank 1
 asked on 17 May 2018
2 answers
189 views

Hey folks,

This should be an easy one, but unfortunately not finding an easy way around it.

 

Problem Statement: When there are no visible characters in the input area, strip out all non-visible characters.

Details:

            Our users can copy past from word files and or other sources, then they can decide to remove it.But this creates HTML equivalents of non-visible characters like 1) Tab, 2) whitespaces, 3)Carriage Returns or any other possible non-visible characters. My requirement is simple, if there are no visible characters, the input area should be reset to nothing or null.But in my case HTML equivalents of the above mentioned visible chars are saved which is not ideal.

I tied some JS to strip those using regular expressions, but not quite working, tried server side one too(c#) but it is messing up the visible content too. Is there a property I can set to make this working ?

 

Thanks for  your help!

Marin Bratanov
Telerik team
 answered on 17 May 2018
10 answers
171 views
I use exporting to PDF in grids.
The problem that the PDF is secured so i can't copy any text from the PDF.
I want it not secured please.
What is the solution ???
Marin Bratanov
Telerik team
 answered on 17 May 2018
0 answers
88 views

I am using Telerik UI for ASP.Net MVC Grid tabstrip. I have two tabs. Problem is that if the model.customerId has decimal in value then it does not call read actions like (.Read(read => read.Action("UserVouchers_Read", "Admin", new { customerId = "#=CustomerId#" }))). The type of customerId is string.

so if the customerId is "123456" then the controller action "UserVouchers_Read" is called.

if the customerId is "123456.123" then the controller action "UserVouchers_Read" is not called called.

Below is my code in the view. Please suggest what could be wrong here.

@(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserDataVM>()
             .Name("Users")
             .DataSource(dataSource => dataSource
                   .Ajax()
                   .ServerOperation(false)
                   .Read(read => read.Action("Users_Read", "Admin"))
                   .Events(events => events.Error("onError"))
               )
             .Columns(columns =>
             {
                 columns.Bound(userData => userData.UserDataId).Visible(false);
                 columns.Bound(userData => userData.CustomerId).Title("Client ID");
                 columns.Bound(userData => userData.FirstName);
                 columns.Bound(userData => userData.CreatedDate).Title("Created Date");
             })
             .Pageable(pager => pager.Input(true).PageSizes(true))
             .Sortable()
             .Scrollable()
             .Filterable()
             .ClientDetailTemplateId("template")
             .HtmlAttributes(new { style = "height:700px;" })
)

<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().TabStrip()
            .Name("tabStrip_#=CustomerId#")
            .SelectedIndex(0)
            .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
            .Items(items =>
            {
                items.Add().Text("Voucher Information").Content(@<text>
            @(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserVoucherVM>()
                        .Name("voucher_#=CustomerId#") // template expression, to be evaluated in the master context
                        .Columns(columns =>
                        {
                            columns.Bound(v => v.UserVoucherId).Width(90).Title("Voucher ID").Filterable(false);
                            columns.Bound(v => v.VoucherNo);
                            columns.Bound(v => v.VoucherValue).Visible(false);
                            columns.Bound(v => v.IsVoucherRedeemedStr).Title("Is Voucher Redeemed");
                            columns.Bound(v => v.CreatedDate).Title("Assigned Date");
                        })
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(5)
                            .ServerOperation(false)
                            .Read(read => read.Action("UserVouchers_Read", "Admin", new { customerId = "#=CustomerId#" }))
                        )
                        .Pageable()
                        .Sortable()
                        .ToClientTemplate())
                </text>
                );
                items.Add().Text("Email Activity").Content(@<text>
            @(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserVoucherVM>()
                        .Name("email_#=CustomerId#") // template expression, to be evaluated in the master context
                        .Columns(columns =>
                        {
                            columns.Bound(v => v.UserVoucherId).Width(50).Title("Email ID").Filterable(false);
                            columns.Bound(v => v.CreatedDate).Width(50).Title("Email Sent Date");
                        })
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(5)
                            .ServerOperation(false)
                            .Read(read => read.Action("UserEmails_Read", "Admin", new { customerId = "#=CustomerId#" }))
                        )
                        .Pageable()
                        .Sortable()
                        .ToClientTemplate())
                </text>
                );
            })
            .ToClientTemplate())
</script>

=========== Code in controller ==========

public ActionResult UserVouchers_Read(string customerID, [DataSourceRequest] DataSourceRequest request)
    {
        IEnumerable<Model.UserVoucherVM> userDataVM = userDataBusiness.GetUserVouchers(customerID);
         return Json(userDataVM.ToDataSourceResult(request));
    }

 

Kamran
Top achievements
Rank 1
 asked on 16 May 2018
6 answers
787 views
I have the following radtextbox that is set in the aspx so it is hidden on page load.

<b>&lt;telerik:RadTextBox ID="pName" runat="server" style="display:none" &gt;&lt;/telerik:RadTextBox&gt;</b> 


I am trying to show it on different events, one of which is on rowclick of a radgrid. I have this in my javascript code and it is not working ( i tried setting it to "" to "block" and to "inline" and it never shows.

 
document.getElementById('pName').style.display = ''; 


I also try setting it in C#:

pName.Style.Add("display", "block"); 
 

And nothing I do makes it appear on the page.


Matt
Top achievements
Rank 1
 answered on 16 May 2018
0 answers
231 views

I have a RadGrid with a NestedViewTemplate that contains a RadTabStrip and RadMultiPage. On each RadPageView there is another RadGrid that displays a sub-set of items related to the id of the item that is being expanded.

In addition, the columns of all RadGrids on the page are hidden/displayed according to a corresponding List<string> variable containing the column names that I want to be displayed. The columns are hidden in the grid_PreRender event IF their uniqueName is NOT in the list of column names.

I have two main problems:

The first problem is that while this _PreRender hiding of columns is working fine in the parent grid and any grid found in the first expanded row, any grids found in other expanded rows do not seem to be experiencing the PreRender event and therefore the columns that should be hidden are being displayed.

The second problem is that I need to be able to show/hide the columns on the client side when the user clicks on the corresponding checkbox in a RadTreeView containing all the columns of all the grids on the page. I have managed to get this working fine for the main grid and the first expanded row grids. The issue is that if multiple rows of the main grid are expanded then many instances of a child grid are displayed and I need client side code that can target all the displayed child grids and hide/show the selected column.

<telerik:RadGrid ID="gvEventListing" runat="server" PageSize="10" Skin="Silk"
AllowSorting="True" AllowMultiRowSelection="True" AllowPaging="True" AllowCustomPaging="True" ShowGroupPanel="True" OnPreRender="gvEventListing_PreRender"
AutoGenerateColumns="False" GridLines="none" OnGroupsChanging="gvEventListing_GroupsChanging" OnItemCommand="gvEventListing_ItemCommand"
OnItemCreated="gvEventListing_ItemCreated" OnNeedDataSource="gvEventListing_OnNeedDataSource" OnItemDataBound="gvEventListing_ItemDataBound">
<PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
<MasterTableView DataKeyNames="IncidentSID,FacilityID" AllowMultiColumnSorting="True">
    <NestedViewTemplate>
        <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">
            <telerik:RadTabStrip Skin="MetroTouch" runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0" OnClientTabSelecting="OnClientTabSelectingHandler">
                <Tabs>
                    <telerik:RadTab runat="server" Text="Participants" PageViewID="PageView1">
                    </telerik:RadTab>
                    <telerik:RadTab runat="server" Text="Comments" PageViewID="PageView2">
                    </telerik:RadTab>
                    <telerik:RadTab runat="server" Text="Phase Progression" PageViewID="PageView3">
                    </telerik:RadTab>
                    <telerik:RadTab runat="server" Text="Notifications" PageViewID="PageView4">
                    </telerik:RadTab>
                    <telerik:RadTab runat="server" Text="Corrective Actions" PageViewID="PageView5">
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>
            <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="False">                           
                <telerik:RadPageView runat="server" ID="PageView1" Width="100%">
                    <telerik:RadGrid runat="server" ID="gvParticipants" ShowFooter="false" Skin="Silk" OnPreRender="gvParticipants_PreRender" CssClass="gvParticipants"
                    AllowSorting="true" EnableLinqExpressions="false" OnNeedDataSource="gvParticipants_OnNeedDataSource">
                        <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
                        DataKeyNames="ParticipantSID" PageSize="7" HierarchyLoadMode="ServerOnDemand">
                            <Columns>
                                <telerik:GridBoundColumn SortExpression="PersonID" HeaderText="PersonID" HeaderButtonType="TextButton"
                                DataField="PersonID" UniqueName="PersonID"></telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="ParticipationTypeLabel" HeaderText="Participation" HeaderButtonType="TextButton"
                                DataField="ParticipationTypeLabel" UniqueName="ParticipationTypeLabel"></telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="Name" HeaderText="Name" HeaderButtonType="TextButton"
                                DataField="Name" UniqueName="Name"></telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="Identifier" HeaderText="Rec#/Emp ID" HeaderButtonType="TextButton"
                                DataField="Identifier" UniqueName="Identifier"></telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                        <ClientSettings AllowDragToGroup="true">
                            <Scrolling AllowScroll="true" ScrollHeight="" />
                        </ClientSettings>
                    <PagerStyle PageButtonCount="3" Mode="NextPrevAndNumeric" ShowPagerText="false" />
                    </telerik:RadGrid>
                </telerik:RadPageView>
protected void gvParticipants_PreRender(object sender, EventArgs e)
{      
    GridNestedViewItem item = (GridNestedViewItem)gvEventListing.MasterTableView.GetItems(GridItemType.NestedView)[0];
    RadGrid grid = (RadGrid)item.FindControl("gvParticipants");
    foreach (GridColumn col in grid.Columns)
    {
        if (!_fields_participants.Contains(col.UniqueName))
        {
            col.Display = false;
        }
    }
}
Michael
Top achievements
Rank 1
 asked on 16 May 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?