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

I have a RadDataForm that contains several RadDropdownLists.   They are all using client binding each with their own instance of RadClientDataSource.

 

How can I unsure the dropdown list data is retrieved and bound before the dataform data is retrieved and attempted to bind?

 

eg.  I have event handler on OnSetValues as follows:

<telerik:RadDataForm RenderMode="Lightweight" runat="server" ID="RadDataForm1"
    DataKeyNames="RecordID" RenderWrapper="true"  ClientDataSourceID="RadClientDataSource1">
    <ClientSettings>
        <ClientEvents OnSetValues="dataFormSetValues" OnGetValues="dataFormGetValues" OnDataFormCreated="dataFormCreated"       />
    </ClientSettings>

 

function dataFormSetValues(sender, args) { 
 
        var dataItem = args;
 
       $telerik.findControl(document, "EditJobTypeDD").findItemByValue(dataItem.JobType).select();
 }

 

The .select() in the javascript function above will fail occasionally when the webservice for the form data returns quicker than the webservice to populate the dropdown list, because there are no items in the dropdownlist yet.

 

Is there a best practice to implement this sort of scenario correctly?

Eyup
Telerik team
 answered on 02 Jan 2020
3 answers
110 views

Hi All,

I copied the demo code for Excel-Like filtering (here) into one of my projects, but the checkboxes in the filterlist are not rendering. However, they do render in the demo app on the Telerik website.

Possible bug in my version of the controls? I'm on 2019.3.1023.45.

Thx in advance - M.

Rumen
Telerik team
 answered on 31 Dec 2019
1 answer
165 views

Hi all

I am trying to create a RadGrid where the value of the product tags are replaced by the tag name. I attached and image for the grid I want to replace the product tag column with the names instead of the values.

Eyup
Telerik team
 answered on 31 Dec 2019
2 answers
236 views

Hi there,

 

I'm trying to use RadlistBox with custom item template under RadAjaxPanel where my page is a webform which use a MasterPage file.

And I'm receiving the following error:

Server Error in '/' Application.

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).] System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +9812992 Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +142 [HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.] Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +190 Telerik.Web.UI.RadAjaxControl.PerformRender() +405 Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1187 Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +75 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +270 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +14 System.Web.UI.Page.Render(HtmlTextWriter writer) +30 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +67 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +101 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +27 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1342

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.3752.0

 

How can I solved it? below is my asp.net webform  declaration.

 

Looking forward to your earliest reply,

Thanks,

Hagai.

<telerik:RadAjaxPanel ID="RadAjaxPanelPublications" runat="server">
   <telerik:RadListBox ID="RadListBoxPublications" runat="server" AllowReorder="True" EnableDragAndDrop="True" SelectionMode="Multiple" Width="98%" Height="700px">      
       <ItemTemplate>           
           <div class="row">
               <div class="col-md-9">
                   <div dir="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Language == Idc.FacultySites.Models.Publication.LanguageName.Hebrew? "rtl" : "ltr" %>"
                       class="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Language == Idc.FacultySites.Models.Publication.LanguageName.Hebrew? "text-right-fix" : "text-left-fix" %>">
                       <a id="PublicationLink" runat="server">
                           <%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Text %>
                       </a>
                   </div>
               </div>
               <div class="col-md-1"> </div>
               <div class="col-md-2">
                   <div class="row">
                       <div class="col-md-2">
                           <telerik:RadButton ID="RadButtonEditPublication" runat="server" RenderMode="Lightweight" ToolTip="<%$ Resources:FacultySites, Edit%>" CommandArgument="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Id %>" OnCommand="RadButtonEditPublication_Command">
                               <ContentTemplate>
                                   <span class="glyphicon glyphicon-edit"></span>
                               </ContentTemplate>
                           </telerik:RadButton>
                       </div>
                       <div class="col-md-2">
                           <telerik:RadButton ID="RadButtonDeletePublication" runat="server" RenderMode="Lightweight" ToolTip="<%$ Resources:FacultySites, Delete%>" OnClick="RadButtonDeletePublication_Click" CommandArgument="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Id %>" OnCommand="RadButtonDeletePublication_Command">
                               <ContentTemplate>
                                   <span class="glyphicon glyphicon-remove"></span>
                               </ContentTemplate>
                               <ConfirmSettings ConfirmText="<%$ Resources:FacultySites, GeneralActionConfirmMessage%>" />
                           </telerik:RadButton>
                       </div>
                       <div class="col-md-8"> </div>
                   </div>
               </div>
           </div>
           <div class="row">
               <div class="col-md-12"> </div>
           </div>               
       </ItemTemplate>
   </telerik:RadListBox>
   </telerik:RadAjaxPanel>

 

Eyup
Telerik team
 answered on 31 Dec 2019
12 answers
224 views

Hello,

I have my grid in ajaxpanel.

With one Edit link button,

When I click on Edit button my header flicks.

Is there any way to find Linkbuttons ClientDatakey so that we can avoid post back ?

Thanks 

Ashish

Eyup
Telerik team
 answered on 31 Dec 2019
1 answer
104 views

There's an oddity when using shift and the left arrow key to select text, where it will skip the first character and then start over. This only happens when using the left arrow, and only at the last word in a line, which makes me think that there's something strange going on with how whatever this is treats the ends of lines.

Highlighting using arrow keys top to bottom and right to left seems fine. But highlighting left to right and bottom to top, seems to cut off highlighting and it doesn't highlight the text as you expect, but instead un-highlights sections you've previously highlighted. 

Reproducible here https://demos.telerik.com/aspnet-ajax/editor/examples/overview/defaultcs.aspx 

Any help would be appreciated.

Rumen
Telerik team
 answered on 30 Dec 2019
1 answer
165 views
     Hi;

I had added the radnavigation to a masterpage. Everything works well if there is no ajax postback in pages.. When you make a ajax postback with ajaxmanagerproxy in a page, the navigation locks and can't use.. Only nodes without subitems can be clickable...
Rumen
Telerik team
 answered on 30 Dec 2019
9 answers
452 views

I’m trying to set up a call to an api method inside of some client side javascript.
The javascript function (GetDb) is called from the ClientEvents-OnValueChanged event of a RadMaskedTextBox

In that javascript function I set the url of a RadClientDataSource and do a fetch. To be honest I don’t completely understand how this works and how I can access the data using the RadClientDataSource after the fetch. My goal is to call the api through the javascript and get data back that I need to use.

As you can see in the RadClientDataSource, I have a dummy url which I replace in the Javascript function GetDb. I did this because if there was an empty url in the RadClientDataSource I was unable to set the dataSource._transport.read.url in the javascript. The url will have to be created dynamically in the long run (right now it’s hard coded) so I am changing the transport url in the javascript. Eventually the final parameter in the rest call in the url will have to be passed and will be variable.

From what I can see the a RadClientDataSource is not being activated and the api method is not being called. After the fetch I looked at the data source property and there were no rows

I set up the API by creating a Controllers folder in my project and then adding a scaffolded controller that uses Entity framework. This API controller inherits from APIController.

I tested the controller by running the function I want to use (GetMeasureByControlName) in fiddler and it worked.

Below is the code. I pieced this together from existing examples but there is none that do exactly what I want. I’d appreciate any help.

<telerik:RadMaskedTextBox ID="RadMaskedTextBox1" runat="server" Width="80px" Mask="##.##" ClientEvents-OnValueChanged="GetDb" >  </telerik:RadMaskedTextBox>



<telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
    <DataSource>
        <WebServiceDataSourceSettings ServiceType="OData">
            <Select Url="localhost:53558/api/measure/GetProductById/blah" DataType="JSONP" />
        </WebServiceDataSourceSettings>
    </DataSource>
</telerik:RadClientDataSource>

I set a dummy url because unless there was something in there I couldn’t reset the transport url below in GetDb (javascript function).

 

Here is Clientside code called by the RadMaskedTextBox1 above:

function GetDb(sender, args) {
            debugger;
            var docTypeID='<%=Session["DocTypeId"]%>';
            if (args != null) {
                var value = args.get_newValue();
                var dataSource = $find("<%= RadClientDataSource1.ClientID%>");
                dataSource._transport.baseUrl = 'http://localhost:53558/api/documentmeasuretypes/';
                dataSource._transport.read.url = dataSource._transport.baseUrl + "GetMeasureByControlName/CYLINDER%20BLOCK%20HEIGHT";
                dataSource.fetch();
                var items = dataSource.view();
                var item = items[0];
                alert(item);
                alert('after fetch');
            }
        }

After the fetch the Total rows in the data source was 0.

The controller method does work; I tested it in fiddler. Here it is.
        public DocumentMeasureType GetMeasureByControlName(string controlname)
        {
            using (APIManufacturingEntitiesConsolidated db = new APIManufacturingEntitiesConsolidated())
            {
                var product = db.DocumentMeasureTypes.FirstOrDefault(m => m.MeasureName.Contains(controlname));
                if (product == null)
                {
                    throw new HttpResponseException(HttpStatusCode.NotFound);
                }
                return product;
            }
        }

 

And here is the routing:
  RouteTable.Routes.MapHttpRoute(
           name: "ActionApi",
           routeTemplate: "api/{controller}/{action}/{controlname}",
           defaults: new { id = RouteParameter.Optional }
);

            RouteTable.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = System.Web.Http.RouteParameter.Optional }




Eric R | Senior Technical Support Engineer
Telerik team
 answered on 27 Dec 2019
7 answers
121 views
We implemented the radhtml chart . We are showing the chart using iframe . In that iframe  we have a page redirection ,in that redirected page have binding methods and all . by the time chart is loading correctly but legend is overlapping in IE browser (IE-8 & IE-9) . Other browser that is chrome and firefox legend displayed correctly .Please see attached image for a visual explanation.

Parent page : 

      <div class="chartDiv" style="width: 730px; height: 620px;">
                                   <iframe src="ShowChart.aspx" frameborder="0" width="720px" height="585px" scrolling="no">
                                    </iframe>
                            </div>

child page : 

     <div>
                       <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                    </telerik:RadScriptManager>
                        <telerik:RadHtmlChart ID="BigHtmlChart" runat="server" Width="700px"  Height= "480px">
                            <PlotArea> 
                                <Series>
                                </Series>
                            </PlotArea>
                        </telerik:RadHtmlChart>
                    </div>
Rajesh
Top achievements
Rank 1
 answered on 27 Dec 2019
4 answers
102 views

I am trying to redirect to another page on process cancellation (triggered by cancel button).

My progress event is running on separate thread, here is the code:

Public Sub ProgressArea()

        Do
            Dim dt As DataTable = AdminData.getLogPercent(Session("ProjectID"))

            Dim count As Integer = dt.Rows(0)("PercentDone")
            Dim message As String = dt.Rows(0)("RecordDesc")

            context.SecondaryValue = "Total Progress: " & count.ToString() + "%"
            context.SecondaryPercent = count.ToString()
            context.CurrentOperationText = message

            If Response.IsClientConnected = False Then

                Response.Redirect("redirect.aspx")

            End If

            If count < 98 Then
                'calls to itself to repeat
                Thread.Sleep(1000)
            Else
                Exit Do
            End If

        Loop

    End Sub

Code hits the redirect , but nothing happens. However if i redirect without clicking "Cancel" button it does work.

I am completely lost. Any help?

Thank you

David
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 26 Dec 2019
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?