Quantcast
Channel: Telerik Forums RSS
Viewing all 94857 articles
Browse latest View live

Cancel delete and edit the current record

$
0
0

The record changes in the background, but the RadDataForm and RadGridView still display the previous state.

<telerik:RadGridView x:Name="MyGridView"Grid.Column="0"Grid.Row="1"IsSynchronizedWithCurrentItem="True"ShowSearchPanel="False"
                                ItemsSource="{DynamicResource peopleViewSource}"
                                SelectedCellsChanged="MyGridView_SelectedCellsChanged"
                                SelectedCellsChanging="MyGridView_SelectedCellsChanging"
                                SelectionChanged="MyGridView_SelectionChanged"
                                SelectionChanging="MyGridView_SelectionChanging"IsReadOnly="True"SearchPanelVisibilityChanged="MyGridView_SearchPanelVisibilityChanged"AutoGeneratingColumn="MyGridView_AutoGeneratingColumn"/>
       <telerik:RadDataForm x:Name="MyDataForm"Grid.Column="0"Grid.Row="3"Header="Detailansicht"LabelPosition="Above"
                            CurrentItem="{Binding ElementName=MyGridView, Path=CurrentItem, Mode=TwoWay, NotifyOnTargetUpdated=True, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
                            ItemsSource="{Binding Items, ElementName=MyGridView}"
                            AddedNewItem="MyDataForm_AddedNewItem"
                            AddingNewItem="MyDataForm_AddingNewItem"
                            BeginningEdit="MyDataForm_BeginningEdit"
                            DeletedItem="MyDataForm_DeletedItem"
                            DeletingItem="MyDataForm_DeletingItem"
                            EditEnded="MyDataForm_EditEnded"
                            EditEnding="MyDataForm_EditEnding"
                            ValidatingItem="MyDataForm_ValidatingItem"
                            ValidationSummaryVisibility="Collapsed"
                            CurrentItemChanged="MyDataForm_CurrentItemChanged"
                            AutoGeneratingField="MyDataForm_AutoGeneratingField">
       </telerik:RadDataForm>

 


Telerik WPF Binaries with .NET 4.5 or Higher Runtime

$
0
0

Are there any versions of the Telerik WPF Binaries that use a .NET Runtime of 4.5 or greater? All of the versions I currently have available appear to be targeting a Runtime Version of 4.0.30319. This is in Visual Studio 2015 on Windows 10. The versions of the Telerik WPF Binaries I have available are 2015.3.1104 and 2017.2.503. I have tried using the .45 versions of both binaries and both appear to be targeting 4.0.30319.

We are currently seeing this exception in the Windows Event log after our application runs for a period of time and searching has found that one of the causes of this issue is known in .NET 4.0 and has been resolved in .NET 4.5 and higher.

This is the information from the Windows Event log for the issue causing our application to crash:

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.COMException
   at System.Windows.Media.Composition.DUCE+Channel.SyncFlush()
   at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean, System.Nullable`1<ChannelSet>)
   at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr)
   at System.Windows.Interop.HwndTarget.HandleMessage(MS.Internal.Interop.WindowMessage, IntPtr, IntPtr)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

 

If anyone can point me to a version of Telerik UI for WPF that uses a runtime of 4.5 or greater (or a list of released versions and the targeted runtimes) so we can try to see if that resolves our issue it would be much appreciated!

Detail section - page break on each record

$
0
0

Hello, I'm using: Telerik Report Designer (Versión 8.2.14.2017). My issue:

I need to display every record to start on a new page, for example, if Item "1" needs 1.5 pages to be dispalyed, then the next Item "2" must start in page 3 (not in page 2) and so on...

I have a Group Header Section and also a Group Footer Section and they are working as espected.

I have tried a lot of combinations on PageBreak and Keep Together properties and is not working.

Regards, thanks for your help.

David

Leading zero for RadMaskedEditBox DateTime formatting

$
0
0

I'm using the absolute latest version of Telerik and this is still an issue.

Please tell me how I can take a mask of 00-00-0000 and set a RadMaskedEditBox.Value = "01-01-1960"

The desired result would be: "01-01-1960" but the current control returns this: "11-19-60__"

Clearly - not the correct value.

 

Any help would be appreciated.

 

 

Bind Full-Text-Search to custom TextBox?

$
0
0

Any news on this?  I want to use our own UI and not something baked in.   I don't want to show this UI initially.   I would like a more cleaner solution.  Can I construct the SearchViewModel?

 

 

"Missing report name" using UriReportSource

$
0
0

I've developed some .trdp reports with the Report Designer R1 2018 standalone app and I'm trying to display them using an MVC view and Telerik Reporting v 12.0.18.125.  I had it working for about an hour last week, but since then I keep running into a 400 Bad Request error with the message "Report name missing".

I added the View and required REST API and everything else by using the Add->New Item->Telerik MVC Report Viewer View R1 2018 template.  The ReportsController is unchanged from the default that was added:

publicclassReportsController : ReportsControllerBase
{
    staticReportServiceConfiguration configurationInstance;
 
    staticReportsController()
    {
        var appPath = HttpContext.Current.Server.MapPath("~/");
        var reportsPath = Path.Combine(appPath, "Reports");
 
 
        var resolver = newReportFileResolver(reportsPath)
            .AddFallbackResolver(newReportTypeResolver());
 
        configurationInstance = newReportServiceConfiguration
        {
            HostAppId = "Html5App",
            Storage = newFileStorage(),
            ReportResolver = resolver,
        };
    }
 
    publicReportsController()
    {
        this.ReportServiceConfiguration = configurationInstance;
    }
}

 

Likewise, the View is the default that was added (renamed to TestReport.cshtml):

@using Telerik.Reporting
@using Telerik.ReportViewer.Mvc
@{
    Layout = null;
}
<!DOCTYPE html>
<head>
    <title>Telerik MVC HTML5 Report Viewer</title>
 
    <metahttp-equiv="X-UA-Compatible"content="IE=edge">
 
    <metaname="viewport"content="width=device-width, initial-scale=1, maximum-scale=1"/>
 
    <scriptsrc="http://code.jquery.com/jquery-1.9.1.min.js"></script>
 
 
    <!--kendo.all.min.js can be used as well instead of the following custom Kendo UI subset-->
    <scriptsrc="@Url.Content("~/ReportViewer/js/telerikReportViewer.kendo-12.0.18.125.min.js")"></script>
 
    <style>
        #reportViewer1 {
            position: relative;
            width: 1300px;
            height: 900px;
            font-family: Verdana, Arial;
        }
    </style>
 
    <scriptsrc="@Url.Content("~/ReportViewer/js/telerikReportViewer-12.0.18.125.min.js")"></script>
 
</head>
<body>
 
@(Html.TelerikReporting().ReportViewer()
        .Id("reportViewer1")
        .ServiceUrl(Url.Content("~/api/reports"))
        .ReportSource(new UriReportSource() { Uri = "TestReport.trdp" })
        .ViewMode(ViewMode.Interactive)
        .ScaleMode(ScaleMode.Specific)
        .Scale(1.0)
        .PersistSession(false)
        .PrintMode(PrintMode.AutoSelect)
        .EnableAccessibility(false)
)
 
</body>
</html>

 

The following line was added to Global.asax.cs by the wizard:

Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(System.Web.Http.GlobalConfiguration.Configuration);

 

There is a Reports folder containing the file TestReport.trdp, as well as a ReportViewer/js folder containing two telerikReportViewer*.js files.  There is a TestReport action in my Test controller that simply returns View().  I am not aware of any changes I've made to the defaults made by the wizard (e.g. no custom report resolver).

When I hit that view and look at the Network traffic in developer tools, I can see that it successfully makes a request to http://localhost:12345/api/reports/clients and receives a response, so I believe the REST service is running.  However, when it tries to call http://localhost:12345/api/reports/clients/115238-abc3/parameters with request body {parameterValues:{}, report:"TestReport.trdp"}, it always responds with {"message":"Missing report name"}, regardless of whether the filename in the Uri is one I know to be in the Reports folder.

I'm able to render and export the report as a PDF by putting the following in an Action, so I believe that a) the report can be found and read and b) it is not corrupt or otherwise has errors:

ReportProcessor rp = newReportProcessor();
Hashtable deviceInfo = newHashtable();
UriReportSource reportSource = newUriReportSource();
reportSource.Uri = "Reports/TestReport.trdp";
RenderingResult result = rp.RenderReport("PDF", reportSource, deviceInfo);
 
using(FileStream fs = newFileStream(outputPath, FileMode.Create)) {
    fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
}

 

I also set up a very small MVC project to try to debug and successfully got reports to render in that.  When I try to resolve a report that doesn't exist (e.g. zzzTestReport.trdp) using this project, it returns the message "Report 'zzzTestReport.trdp' cannot be resolved.", so I believe the "Missing report name" error has nothing to do with not being able to find the report.

I've tried importing the .trdp file to create a report class and rendering using a TypeReportSource, and I've even tried removing any trace of the report viewer from the project and re-adding it.  No matter what I do, I keep getting the same "Missing report name" error.  I'm guessing there's a configuration error or something hidden deep in my project, but I can't for the life of me find where (even when comparing to a working project), and the error message itself isn't providing any guidance.  If anybody can offer any insights on how to get reports to render (or really just to have the api return something useful for the parameters call), I would greatly appreciate it.

Thanks!

 

Tooltip showing is too aggressive

$
0
0

Very cool, thank you! I have also been looking at this, and I was able to get this to work via the following. Using Q1 2018 of Kendo.all.js to work on this. I am thinking I will switch to your method.

Under my method, the first tooltip that shows is whatever you are closest to. An subsequent tooltip on the same series will only show if you are very close to it. I do not always have the circles displayed for the user to hover on. This is because a chart can currently have 70+ data points so the circle sizes are scaled down in many cases. They are there but would be very hard to hit exactly.

My changes are bolded.

Line 152832:
            aliasFor: function (e, coords) {

                // Added the undefined to this function call
                return this.parent.getNearestPoint(coords.x, coords.y, this.seriesIx, undefined);
            }

Line 152951:
            getNearestPoint: function (x, y, seriesIx, oldPoint) {
                var target = new Point(x, y);
                var allPoints = this.seriesPoints[seriesIx];

                // The point distance to search will be closest possible value, OR really close to override
                // whatever is showing now. Allows us to hit hints.
                var nearestPointDistance = (oldPoint ? 12 : MAX_VALUE);
                var nearestPoint = oldPoint;

                for (var i = 0; i < allPoints.length; i++) {
                    var point = allPoints[i];
                    if (point && defined(point.value) && point.value !== null && point.visible !== false) {
                        var pointBox = point.box;
                        var pointDistance = pointBox.center().distanceTo(target);
                        if (pointDistance < nearestPointDistance) {
                            nearestPoint = point;
                            nearestPointDistance = pointDistance;
                        }
                    }
                }
                return nearestPoint;
            }

Line 162282:
                if (point && !point.hover(this, e)) {
                    // If a tooltip is showing we will not switch to a new point here. This will still happen via other code,
                    // However we'll need to basically be right on top of it for that to take place.
                    if (typeof(this._tooltip._current) === "undefined") {

                       this._activePoint = point;
                       var tooltipOptions = deepExtend({}, tooltipOptions, point.options.tooltip);
                       if (tooltipOptions.visible) {
                           tooltip.show(point);
                       }
                       highlight.show(point);
                    } else {
                       point = undefined;
                    }
                    return point;
                }

Line 162316:
      var seriesPoint = point.parent.getNearestPoint(coords.x, coords.y, point.seriesIx, point);

RadDataGrid with specific Columns, Aggregation and Grouping in C#

$
0
0

Hi Stefan, 

That would be a great help, unfortunately it seems you have attached the previous example.

Thanks

Pierre


Text search on listbox with DataTemplate

$
0
0
Thanks Vladmir, it's working nicely with build 2018.1.205

Can't Update Label in RadListView

$
0
0

I am trying to update a RadLabel control that is inside of a RadlistView which is inside of a RadAjaxPanel.  I have a user control on my aspx page that calls a public event handler when a modal on the user control closes.  I can access the RadLabel, but it doesn't update.

Here is my HTML:

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" BackColor="White">
                <div class="form-group">
                        <asp:RadioButtonList ID="radioChoice" runat="server" RepeatDirection="Horizontal" AutoPostBack="true" CssClass="inline-rb" OnSelectedIndexChanged="radioChoice_SelectedIndexChanged">
                            <asp:ListItem Value="Multiple" Text="Multiple Record Report" Selected="True" />
                            <asp:ListItem Value="Single" Text="Single Record Report" />
                        </asp:RadioButtonList>
                    </div>
                <asp:HiddenField runat="server" ID="panelCollapse" ClientIDMode="Static" />
                <asp:HiddenField runat="server" ID="SelectedItem" />
                <hr />
                <telerik:RadListView runat="server" ID="radlistview1" OnItemDataBound="radlistview1_ItemDataBound" EnableViewState="false">
                    <ItemTemplate>
                        <div class="panel panel-default">
                            <div class="panel-heading" style="border:none; padding:0px !important">
                                <h4 class="panel-title">
                                    <a data-toggle="collapse" href="#pnl<%#Eval("ModuleDataKey") %>" rel="popover" data-placement="top" data-content="Click to expand/collapse report list" data-trigger="hover"><i class="s7-plus"></i></a>&nbsp;<%#Eval("ModuleDataKey") %>
                                </h4>
                            </div>
                            <div id='pnl<%#Eval("ModuleDataKey") %>' class="panel-collapse collapse">
                                <div class="panel-body" style="padding:0px !important 10px 0px 10px">
                                    <div runat="server" id="divNoResults" style="background-color:#ED4B4B;color:white" visible="false"><asp:PlaceHolder ID="noResults" runat="server"></asp:PlaceHolder> </div>
                                    <div class="panel panel-alt3 panel-transparent" style="padding: 0px !important">
                                        <div class="panel-heading panel-heading-cg" style="overflow:visible">
                                            <div class="input-group">
                                                <span runat="server" class="media" id="spFilter" visible='<%# DataBinder.Eval(Container.DataItem, "ModuleDataKey").ToString().ToLower() == "activity" ? false : true %>'>
                                                    <button type="button" data-toggle="dropdown" title="Filter List" class="btn btn-alt3"  id="btnFilter" runat="server"><i class="icon icon-left s7-filter"></i><span class="caret"></button>
                                                    <ul role="menu" class="dropdown-menu">
                                                        <li runat="server" id="btnCustomFilter"><asp:LinkButton runat="server" ID="lnkCustom" OnClick="customFilterLink_ServerClick" OnClientClick="javascript:OpenFilterModal();" >Custom</asp:LinkButton></li>
                                                        <li class="divider"></li>
                                                        <asp:PlaceHolder runat="server" ID="hldFilters"></asp:PlaceHolder>
                                                    </ul>
                                                </span>
                                                <span id="ddlLists" runat="server" visible="false" style="display:inline" >
                                                    <span runat="server"  id="spJobDropDown" visible='<%# DataBinder.Eval(Container.DataItem, "ModuleDataKey").ToString().ToLower() == "job" ? true : false %>'>
                                                        <telerik:RadComboBox DropDownAutoWidth="Enabled" RenderMode="Lightweight" ID="qfTicket_cmbJob" EmptyMessage="Type to Select..." runat="server" Width="500px" EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true" OnSelectedIndexChanged="qfTicket_cmbJob_SelectedIndexChanged" >
                                                            <WebServiceSettings Method="GetJobs" Path="~/Portal/Ajax/COGS.asmx" />
                                                        </telerik:RadComboBox>
                                                    </span>
                                                    <span runat="server" id="spTicketDropdown" visible='<%# DataBinder.Eval(Container.DataItem, "ModuleDataKey").ToString().ToLower() == "ticket" ? true : false %>'>
                                                        <telerik:RadComboBox DropDownAutoWidth="Enabled" RenderMode="Lightweight" ID="cmbTicket" EmptyMessage="Type to Select..." runat="server" Width="333px" ClientIDMode="Static" EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true" OnSelectedIndexChanged="cmbTicket_SelectedIndexChanged" AutoPostBack="true" >
                                                            <WebServiceSettings Method="GetTickets" Path="~/Portal/Ajax/COGS.asmx" />
                                                        </telerik:RadComboBox>
                                                    </span>
                                                </span>
                                                <span runat="server" id="spActivity" visible='<%# DataBinder.Eval(Container.DataItem, "ModuleDataKey").ToString().ToLower() == "activity" ? true : false %>'>
                                                    Asset&nbsp;&nbsp
                                        <asp:DropDownList runat="server" ID="ddlAssets" ForeColor="Black" Font-Size="Small"></asp:DropDownList>
                                           &nbsp;&nbsp; Date &nbsp;&nbsp;<i class="s7-date" style="font-size:x-large;display:inline"></i><asp:TextBox runat="server" ID="txtReportDate" ClientIDMode="Static" Font-Size="Small" ForeColor="Black" CssClass="datepicker" placeholder="m/d/yyyy" ></asp:TextBox>
                                                    </span>
                                            </div>
                                                <div runat="server" id="SelectedFilter" style="background-color:#fff2d7; color:black;padding-left:10px" ><telerik:RadLabel runat="server" ID="filterName" Font-Size="Small"></telerik:RadLabel></div>
                                        </div> 
                                        <div class="panel-body" style="padding-top:10px">
                                            <br />
                                            <asp:HiddenField ID="hfModule" Value='<%#Eval("ModuleDataKey") %>' runat="server" />
                                            <asp:PlaceHolder ID="phRow" runat="server"></asp:PlaceHolder>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </ItemTemplate>
                </telerik:RadListView>
            </telerik:RadAjaxPanel>

 Here is my EventHandler:

        private void JobFilterControl_CustomJobFilterSaved(object sender, EventArgs e)
        {
            foreach (RadListViewItem item in radlistview1.Items)
            {
                string module = ((HiddenField)item.FindControl("hfModule")).Value;

                RadLabel filterName = item.FindControl("filterName") as RadLabel;

                switch (module)
                {
                    case "JOB":
                        filterName.Text = "Selected Filter: " + Session["SavedJobFilterName"].ToString();
                        break;
                    case "TICKET":
                        filterName.Text = "Selected Filter: All";
                        break;
                }
            }
        }

All of the code works as expected except that the Label Text does not update.  Is there anyting I can do to get this to work?  Any assistance is greatly appreciated.

ListView changing datasource

$
0
0

I'll try, but actually I've noticed it can happen even after assigning the datasource just once.

Also I'm using custom items and BindingList, e.g. (below, edited)

The exception can occur after just clicking on a single item in the list. I'll try and modify your project to make it happen.

 

_dataSource = newBindingList<MyVisualItemDef>(); // field
SomeItems.ForEach(item => _dataSource.Add(
    newMyVisualItemDef
    {
        RuleItemId = item.RuleItemId,
        Sequence = item.Sequence,
        Name = item.Name,
        RuleItemText = GetSomeTextFor(item)
    }));
lstvwRuleItems.DataSource = null;
lstvwRuleItems.DataSource = _dataSource;

ListView changing datasource

$
0
0

Please find the attached project where the issue occurs.

See comments in method RadForm1.GetRuleItemTextFor()

ListView changing datasource

$
0
0

Keep forgetting I can only post image files... so I'll post the code in code blocks.

class RuleVisualItem

usingSystem;
usingSystem.Drawing;
usingSystem.Windows.Forms;
usingTelerik.WinControls.Layouts;
usingTelerik.WinControls.UI;
 
namespace_1152220
{
    publicclassRuleVisualItem : SimpleListViewVisualItem
    {
        privateRadTextBoxControlElement _idElement;
        privateRadTextBoxControlElement _sequenceElement;
        privateRadTextBoxControlElement _nameElement;
        privateRadTextBoxControlElement _ruleTextElement;
        privateStackLayoutPanel _vStackLayout;
        privateStackLayoutPanel _stackLayout;
 
        protectedoverridevoidCreateChildElements()
        {
            base.CreateChildElements();
 
            _stackLayout = newStackLayoutPanel
            {
                Orientation = Orientation.Horizontal,
                ShouldHandleMouseInput = false,
                NotifyParentOnMouseInput = true
            };
 
            _vStackLayout = newStackLayoutPanel
            {
                Orientation = Orientation.Vertical,
                ShouldHandleMouseInput = false,
                NotifyParentOnMouseInput = true
            };
 
            _sequenceElement = newRadTextBoxControlElement
            {
                Text = "",
                IsReadOnly = true,
                MinSize = newSize(60, 0)
            };
            _stackLayout.Children.Add(_sequenceElement);
 
            _idElement = newRadTextBoxControlElement
            {
                Text = "",
                IsReadOnly = true,
                MinSize = newSize(60, 0)
            };
 
            _stackLayout.Children.Add(_idElement);
 
            _nameElement = newRadTextBoxControlElement
            {
                Text = "",
                IsReadOnly = true,
                MinSize = newSize(120, 0),
            };
            _stackLayout.Children.Add(_nameElement);
 
            _ruleTextElement = newRadTextBoxControlElement
            {
                Text = "",
                //TextWrap = true,
                Multiline = true,
                //IsReadOnly = true,
                ShouldHandleMouseInput = true,
                NotifyParentOnMouseInput = false
            };
 
            _vStackLayout.Children.Add(_stackLayout);
            _vStackLayout.Children.Add(_ruleTextElement);
 
            Children.Add(_vStackLayout);
        }
 
        protectedoverridevoidSynchronizeProperties()
        {
            if(Data == null) return;
 
            base.SynchronizeProperties();
 
            Text = "";
            // must clear the textboxes or the info in them will be scrambled
            // https://www.telerik.com/forums/listview-data#fHqS8X47jkumon6G5VPkrQ
            _idElement.Text = "";
            _sequenceElement.Text = "";
            _nameElement.Text = "";
            _ruleTextElement.Text = "";
            _idElement.Text = Convert.ToString(Data["RuleItemId"]);
            _sequenceElement.Text = Convert.ToString(Data["Sequence"]);
            _nameElement.Text = Convert.ToString(Data["Name"]);
            var ruleItemText = Convert.ToString(Data["RuleItemText"]);
            _ruleTextElement.Text = ruleItemText;
        }
 
        protectedoverrideType ThemeEffectiveType => typeof(SimpleListViewVisualItem);
    }
}

 

class RuleItemVisualItemDef

usingSystem.ComponentModel;
usingSystem.Runtime.CompilerServices;
using_1152220.Annotations;
 
namespace_1152220
{
    publicclassRuleItemVisualItemDef : INotifyPropertyChanged
    {
        privatelong_ruleItemId;
        privatelong_sequence;
        privatestring_name;
        privatestring_ruleItemText;
 
        publiclongRuleItemId
        {
            get{ return_ruleItemId; }
            set
            {
                if(value == _ruleItemId) return;
                _ruleItemId = value;
                OnPropertyChanged();
            }
        }
 
        publiclongSequence
        {
            get{ return_sequence; }
            set
            {
                if(value == _sequence) return;
                _sequence = value;
                OnPropertyChanged();
            }
        }
 
        publicstringName
        {
            get{ return_name; }
            set
            {
                if(value == _name) return;
                _name = value;
                OnPropertyChanged();
            }
        }
 
        publicstringRuleItemText
        {
            get{ return_ruleItemText; }
            set
            {
                if(value == _ruleItemText) return;
                _ruleItemText = value;
                OnPropertyChanged();
            }
        }
 
        publiceventPropertyChangedEventHandler PropertyChanged;
 
        [NotifyPropertyChangedInvocator]
        protectedvirtualvoidOnPropertyChanged([CallerMemberName] stringpropertyName = null)
        {
            PropertyChanged?.Invoke(this, newPropertyChangedEventArgs(propertyName));
        }
    }
}

class RadForm1

usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Text;
usingTelerik.WinControls.UI;
 
namespace_1152220
{
    publicpartialclassRadForm1 : Telerik.WinControls.UI.RadForm
    {
        privateBindingList<RuleItemVisualItemDef> _dataSource;
        privateList<DummyData> _ruleItemDefs;
 
        publicRadForm1()
        {
            InitializeComponent();
 
            lstvwRuleItems.AllowArbitraryItemHeight = true;
            lstvwRuleItems.AllowEdit = false;
            lstvwRuleItems.AllowRemove = false;
            lstvwRuleItems.ViewType = ListViewType.ListView;
 
            _ruleItemDefs = newList<DummyData>();
            for(inti = 1; i < 5; i++)
            {
                _ruleItemDefs.Add( newDummyData
                {
                    Name = $"Rule {i}",
                    RuleItemId = i * 10,
                    Sequence = i
                });
            }
 
            //lstvwRuleItems.ViewType = Telerik.WinControls.UI.ListViewType.DetailsView;
            //lstvwRuleItems.DataSource = GetTable();
            SetViewContents();
        }
 
        privatevoidSetViewContents()
        {
            txtRuleHeading.Text = GetRuleItemHeading();
 
            _dataSource = newBindingList<RuleItemVisualItemDef>();
            _ruleItemDefs.ForEach(def => _dataSource.Add(
                newRuleItemVisualItemDef
                {
                    RuleItemId = def.RuleItemId,
                    Sequence = def.Sequence,
                    Name = def.Name,
                    RuleItemText = GetRuleItemTextFor(def),
                }));
            lstvwRuleItems.DataSource = null;
            lstvwRuleItems.DataSource = _dataSource;
        }
 
        privatestringGetRuleItemTextFor(DummyData def)
        {
            // this one usually works
            //return LoremIpsum(minWords: 0, maxWords: 10, minSentences: 1, maxSentences: 5, numParagraphs: 4);
 
            // this one usually fails (re-run the app if it doesn't)
            returnLoremIpsum(minWords: 10, maxWords: 30, minSentences: 3, maxSentences: 10, numParagraphs: 4);
        }
 
        privatestringGetRuleItemHeading()
        {
            return"some heading";
        }
 
        //static DataTable GetTable()
        //{
        //    DataTable table = new DataTable();
        //    table.Columns.Add("bool", typeof(bool));
        //    table.Columns.Add("Drug", typeof(string));
        //    table.Columns.Add("Name", typeof(string));
        //    table.Columns.Add("Date", typeof(DateTime));
 
        //    table.Rows.Add(false, "Indocin", "David", DateTime.Now);
        //    table.Rows.Add(false, "Enebrel", "Sam", DateTime.Now);
        //    table.Rows.Add(false, "Hydralazine", "Christoff", DateTime.Now);
        //    table.Rows.Add(false, "Combivent", "Janet", DateTime.Now);
        //    table.Rows.Add(false, "Dilantin", "Melanie", DateTime.Now);
        //    return table;
        //}
 
        //private void radButton1_Click(object sender, EventArgs e)
        //{
        //    lstvwRuleItems.DataSource = null;
        //    lstvwRuleItems.DataSource = GetTable();
        //}
        stringLoremIpsum(intminWords, intmaxWords,
            intminSentences, intmaxSentences,
            intnumParagraphs)
        {
 
            var words = new[]{"lorem", "ipsum", "dolor", "sit", "amet", "consectetuer",
                "adipiscing", "elit", "sed", "diam", "nonummy", "nibh", "euismod",
                "tincidunt", "ut", "laoreet", "dolore", "magna", "aliquam", "erat"};
 
            var rand = newRandom();
            intnumSentences = rand.Next(maxSentences - minSentences)
                               + minSentences + 1;
            intnumWords = rand.Next(maxWords - minWords) + minWords + 1;
 
            StringBuilder result = newStringBuilder();
 
            for(intp = 0; p < numParagraphs; p++)
            {
                result.Append("<p>");
                for(ints = 0; s < numSentences; s++)
                {
                    for(intw = 0; w < numWords; w++)
                    {
                        if(w > 0) { result.Append(" "); }
                        result.Append(words[rand.Next(words.Length)]);
                    }
                    result.Append(". ");
                }
                result.Append("</p>");
            }
 
            returnresult.ToString();
        }
 
        privatevoidlstvwRuleItems_VisualItemCreating(objectsender, Telerik.WinControls.UI.ListViewVisualItemCreatingEventArgs e)
        {
            if(this.lstvwRuleItems.ViewType == ListViewType.ListView)
            {
                e.VisualItem = newRuleVisualItem();
            }
        }
    }
 
    internalclassDummyData
    {
        publiclongRuleItemId { get; set; }
        publiclongSequence { get; set; }
        publicstringName { get; set; }
    }
}

 

RadForm1.Designer.cs

namespace_1152220
{
    partialclassRadForm1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        privateSystem.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protectedoverridevoidDispose(booldisposing)
        {
            if(disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        privatevoidInitializeComponent()
        {
            this.txtRuleHeading = newTelerik.WinControls.UI.RadTextBox();
            this.lstvwRuleItems = newTelerik.WinControls.UI.RadListView();
            ((System.ComponentModel.ISupportInitialize)(this.txtRuleHeading)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.lstvwRuleItems)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            this.SuspendLayout();
            //
            // txtRuleHeading
            //
            this.txtRuleHeading.Dock = System.Windows.Forms.DockStyle.Top;
            this.txtRuleHeading.Location = newSystem.Drawing.Point(0, 0);
            this.txtRuleHeading.Name = "txtRuleHeading";
            this.txtRuleHeading.Size = newSystem.Drawing.Size(684, 20);
            this.txtRuleHeading.TabIndex = 0;
            //
            // lstvwRuleItems
            //
            this.lstvwRuleItems.Dock = System.Windows.Forms.DockStyle.Fill;
            this.lstvwRuleItems.Location = newSystem.Drawing.Point(0, 20);
            this.lstvwRuleItems.Name = "lstvwRuleItems";
            this.lstvwRuleItems.Size = newSystem.Drawing.Size(684, 456);
            this.lstvwRuleItems.TabIndex = 1;
            this.lstvwRuleItems.VisualItemCreating += newTelerik.WinControls.UI.ListViewVisualItemCreatingEventHandler(this.lstvwRuleItems_VisualItemCreating);
            //
            // RadForm1
            //
            this.AutoScaleDimensions = newSystem.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = newSystem.Drawing.Size(684, 476);
            this.Controls.Add(this.lstvwRuleItems);
            this.Controls.Add(this.txtRuleHeading);
            this.Name = "RadForm1";
            //
            //
            //
            this.RootElement.ApplyShapeToControl = true;
            this.Text = "RadForm1";
            ((System.ComponentModel.ISupportInitialize)(this.txtRuleHeading)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.lstvwRuleItems)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
 
        }
 
        #endregion
 
        privateTelerik.WinControls.UI.RadTextBox txtRuleHeading;
        privateTelerik.WinControls.UI.RadListView lstvwRuleItems;
    }
}

Prevent sort being set to nothing

$
0
0

I have a simple RadDataGrid with sorting set to... 

    UserSortMode="Single"

    ColumnDataOperationsMode="Inline".

 

Clicking a header for a column goes through three steps. Sort ascending, sort descending and then no sorting. I want to prevent sorting being removed and so clicking the header when it is at sort descending should set it to ascending again. Is this possible?

Visual sort indicator without actually sorting

$
0
0
I would like to see the sort indicator appear on the column headers but without the control actually sorting the rows. When the sorting changes because the user clicks on a header, I programmatically make a new call to the server backend and get back the new results in the correct sort order and assign the new results to the grid. This means I do not want the grid control to sort the current results into a new order whilst waiting for the results to come back. Is there some way to keep the sort indicator working but without the grid actually performing sorting of the rows?

DropDownlist virtual mode using binding seems to ignore the Value property

$
0
0
Hello Andrea,

I am glad to hear that you have managed to successfully resolve the issue faced.

You are indeed correct that the DropDownList's valuePrimitive option will force the ViewModel field to be updated with the selected item's value field. With this change there will be no need to set the ViewModel field explicitly in the select event of the widget.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.

RadScriptManager & SharePoint 2013

$
0
0
Thanks for the links. The above approaches seem to work with SharePoint 2010 but not 2013. I think we'll leave it for the moment as all the controls we've used seem to be working okay.

Drag-drop to another application

$
0
0

How can I drag a node from a TreeView and drop it into another application to provide its information to that app (that's using Telerik controls and/or standard Winforms)? The other application will be one we are developing so it would probably use Telerik Winforms anyway.

Thanks.

Ajax postback first time issue

$
0
0

Hi, we're got a RadGrid on a page with a RadAjaxManager and RadAjaxLoadingPanel. On the first operation, using any of the paging, filtering, sorting etc. the grid doesn't appear to be using ajax on postback. Every other operation after that is fine and works as expected. There are no errors on the client or server side. It's a pretty simple page using version 2018.1.117.40. Thanks!

ASPX

<telerik:RadGridID="rgDocuments"runat="server"GridLines="None"Skin="MetroTouch"OnNeedDataSource="rgDocuments_NeedDataSource"AllowPaging="True"PageSize="18"AllowFilteringByColumn="True"AllowSorting="True"GroupingSettings-CaseSensitive="false"EnableLinqExpressions="False"RenderMode="Lightweight">
    <MasterTableViewAutoGenerateColumns="False"ClientDataKeyNames="docsref"TableLayout="Fixed">
        <Columns>
            <telerik:GridTemplateColumnDataField="docname"HeaderText="Document"SortExpression="docname"UniqueName="docname"HeaderStyle-Width="31%"ItemStyle-Width="31%"ShowFilterIcon="false"FilterControlWidth="400px"AutoPostBackOnFilter="true">
                <ItemTemplate>
                    <spantitle='<%# Eval("docname") %>'>
                        <%# Eval("docname") %></span>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumnDataField="fcName"HeaderText="Area"SortExpression="fcName"UniqueName="fcName"HeaderStyle-Width="15%"HeaderStyle-Wrap="false"ItemStyle-Width="15%"ItemStyle-Wrap="false"ShowFilterIcon="false"AutoPostBackOnFilter="true">
                <FilterTemplate>
                    <telerik:RadComboBoxID="ddlArea"DataSourceID="sdsArea"DataTextField="fcName"DataValueField="fcName"Width="150px"Height="294px"AppendDataBoundItems="true"SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("fcName").CurrentFilterValue %>' runat="server" OnClientSelectedIndexChanged="ddlAreaClientSelectedIndexChanged" Skin="MetroTouch" RenderMode="Lightweight">
                        <Items>
                            <telerik:RadComboBoxItemText="All"/>
                        </Items>
                    </telerik:RadComboBox>
                    <telerik:RadScriptBlockID="RadScriptBlock1"runat="server">
                        <scripttype="text/javascript">
                            function ddlAreaClientSelectedIndexChanged(sender, args) {
                                var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                tableView.filter("fcName", args.get_item().get_value(), "EqualTo");
                        }
                        </script>
                    </telerik:RadScriptBlock>
                </FilterTemplate>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumnDataField="type"HeaderText="Type"SortExpression="type"UniqueName="type"HeaderStyle-Width="15%"HeaderStyle-Wrap="false"ItemStyle-Width="15%"ItemStyle-Wrap="false"ShowFilterIcon="false"AutoPostBackOnFilter="true">
                <FilterTemplate>
                    <telerik:RadComboBoxID="ddlType"DataSourceID="sdsType"DataTextField="type"DataValueField="type"Width="150px"Height="294px"AppendDataBoundItems="true"SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("type").CurrentFilterValue %>' runat="server" OnClientSelectedIndexChanged="ddlTypeClientSelectedIndexChanged" Skin="MetroTouch" RenderMode="Lightweight">
                        <Items>
                            <telerik:RadComboBoxItemText="All"/>
                        </Items>
                    </telerik:RadComboBox>
                    <telerik:RadScriptBlockID="RadScriptBlock2"runat="server">
                        <scripttype="text/javascript">
                            function ddlTypeClientSelectedIndexChanged(sender, args) {
                                var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                tableView.filter("type", args.get_item().get_value(), "EqualTo");
                        }
                        </script>
                    </telerik:RadScriptBlock>
                </FilterTemplate>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumnDataField="subtype"HeaderText="Subtype (leg docs)"SortExpression="subtype"UniqueName="subtype"HeaderStyle-Width="15%"HeaderStyle-Wrap="false"ItemStyle-Width="15%"ItemStyle-Wrap="false"ShowFilterIcon="false"AutoPostBackOnFilter="true">
                <FilterTemplate>
                    <telerik:RadComboBoxID="ddlSubtype"DataSourceID="sdsSubtype"DataTextField="subtype"DataValueField="subtype"Width="150px"Height="294px"AppendDataBoundItems="true"SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("subtype").CurrentFilterValue %>' runat="server" OnClientSelectedIndexChanged="ddlSubtypeClientSelectedIndexChanged" Skin="MetroTouch" RenderMode="Lightweight">
                        <Items>
                            <telerik:RadComboBoxItemText="All"/>
                        </Items>
                    </telerik:RadComboBox>
                    <telerik:RadScriptBlockID="RadScriptBlock3"runat="server">
                        <scripttype="text/javascript">
                            function ddlSubtypeClientSelectedIndexChanged(sender, args) {
                                var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                tableView.filter("subtype", args.get_item().get_value(), "EqualTo");
                        }
                        </script>
                    </telerik:RadScriptBlock>
                </FilterTemplate>
            </telerik:GridBoundColumn>
            <telerik:GridDateTimeColumnDataField="reviewDate"HeaderText="Review Date"SortExpression="reviewDate"UniqueName="reviewDate"PickerType="DatePicker"
                DataFormatString="{0:dd/MM/yyyy}"HeaderStyle-Width="12%"HeaderStyle-Wrap="false"ItemStyle-Width="12%"ItemStyle-Wrap="false"AutoPostBackOnFilter="true"DataType="System.DateTime"ShowFilterIcon="false">
            </telerik:GridDateTimeColumn>
            <telerik:GridBoundColumnDataField="docsref"HeaderText="Doc No."SortExpression="docsref"UniqueName="docsref"HeaderStyle-Width="12%"HeaderStyle-Wrap="false"ItemStyle-Width="12%"ItemStyle-Wrap="false"ShowFilterIcon="false"AutoPostBackOnFilter="true">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <ClientSettingsEnableRowHoverStyle="true">
        <ResizingAllowColumnResize="true"/>
        <ClientEventsOnRowClick="rgDocuments_RowClick"/>
    </ClientSettings>
</telerik:RadGrid>
<asp:SqlDataSourceID="sdsArea"runat="server"ConnectionString="<%$ ConnectionStrings:IntranetConnectionString %>" SelectCommand="sp_docportal_ddl_area" SelectCommandType="StoredProcedure" CancelSelectOnNullParameter="false">
</asp:SqlDataSource>
<asp:SqlDataSourceID="sdsType"runat="server"ConnectionString="<%$ ConnectionStrings:IntranetConnectionString %>" SelectCommand="sp_docportal_ddl_type" SelectCommandType="StoredProcedure" CancelSelectOnNullParameter="false">
</asp:SqlDataSource>
<asp:SqlDataSourceID="sdsSubtype"runat="server"ConnectionString="<%$ ConnectionStrings:IntranetConnectionString %>" SelectCommand="sp_docportal_ddl_subtype" SelectCommandType="StoredProcedure" CancelSelectOnNullParameter="false">
</asp:SqlDataSource>
<telerik:RadAjaxManagerID="RadAjaxManager1"runat="server"EnablePageHeadUpdate="false">
    <AjaxSettings>
        <telerik:AjaxSettingAjaxControlID="rgDocuments">
            <UpdatedControls>
                <telerik:AjaxUpdatedControlControlID="rgDocuments"LoadingPanelID="RadAjaxLoadingPanel1"/>
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

 

CS

protectedvoidrgDocuments_NeedDataSource(objectsender, GridNeedDataSourceEventArgs e)
{
    try
    {
        using(connection = newSqlConnection(@"Server=HA-SQL08;UID=*****;PWD=*****;database=intranet"))
        {
            dt = newDataTable();
            connection.Open();
            command = newSqlCommand("v3_docportal", connection);
            command.CommandType = CommandType.StoredProcedure;
            adapter = newSqlDataAdapter(command);
            adapter.Fill(dt);
            rgDocuments.DataSource = dt;
        }
    }
    catch(Exception ex)
    {
        throwex;
    }
}

 

 

 

DataSpriteCssClassField does not seem to be working

Viewing all 94857 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>