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

Extending DatePicker issue from Razor

$
0
0

Hi,

I would like to normalize the behaviour of our DatePickers and also add some special date support in our application. I have managed to extend the JS version

01./// New date control which extends the DatePicker
02.(function($, kendo) {
03.    varui = kendo.ui,
04.        KendoDatePicker = ui.DatePicker;
05. 
06.    varMyDatePicker = KendoDatePicker.extend({
07.        init: function(element, options) {
08.            varthat = this;
09. 
10.            // Call base init
11.            KendoDatePicker.fn.init.call(this, element, options);
12. 
13.            // Keep a reference around
14.            $(element).data("datePicker", that);
15. 
16....
17....
18. 
19.    // Register this plugin
20.    kendo.ui.plugin(MyDatePicker);
21.})($, window.kendo);

 

This works fine when I call it using data-role="myDatePicker". Now I want to also support setting this up from the MVC Razor views.

I see some examples for setting up extension methods and I have attempted also creating a class derived from DatePicker so that I can support my custom properties as well as to get the data-role set to "myDatePicker". It sort of works, but it does not look like it is setting up properly the base properties such as HtmlAttributes  (Razor sets it up like this:  .HtmlAttributes(new { style = "width:150px" }))... the HTML will output "width: 100%").

Is there a nice example for what I am trying to do?

 

Code in c#

001.namespaceProject.UI.Website.Helpers
002.{
003.    usingSystem;
004.    usingSystem.Collections.Generic;
005.    usingSystem.IO;
006.    usingSystem.Linq;
007.    usingSystem.Web.Mvc;
008. 
009.    usingKendo.Mvc;
010.    usingKendo.Mvc.Extensions;
011.    usingKendo.Mvc.Infrastructure;
012.    usingKendo.Mvc.UI;
013.    usingKendo.Mvc.UI.Fluent;
014. 
015.    publicstaticclassKendoHelperExtensions
016.    {
017.        publicstaticMyDatePickerBuilder MyDatePickerBuilder(thisHtmlHelper helper)
018.        {
019.            WidgetFactory factory = helper.Kendo();
020. 
021.            MyDatePicker picker = newMyDatePicker(
022.                factory.HtmlHelper.ViewContext,
023.                factory.Initializer,
024.                factory.HtmlHelper.ViewData);
025. 
026.            returnnewMyDatePickerBuilder(picker);
027.        }
028.    }
029. 
030.    publicclassMyDatePickerBuilder : DatePickerBuilder
031.    {
032.        publicMyDatePickerBuilder(DatePicker component)
033.            : base(component)
034.        {
035.        }
036. 
037.        privateMyDatePicker Picker => (MyDatePicker)this.Component;
038. 
039.        publicMyDatePickerBuilder AllowEmpty(boolvalue)
040.        {
041.            this.Picker.AllowEmpty = value;
042.            returnthis;
043.        }
044. 
045.        publicMyDatePickerBuilder Name(stringname)
046.        {
047.            this.Component.Name = name;
048.            returnthis;
049.        }
050. 
051.        publicMyDatePickerBuilder HtmlAttributes(objectattributes)
052.        {
053.            return(MyDatePickerBuilder)base.HtmlAttributes(attributes);
054.        }
055.    }
056. 
057.    publicclassMyDatePicker : DatePicker
058.    {
059.        publicMyDatePicker(ViewContext viewContext, IJavaScriptInitializer initializer, ViewDataDictionary viewData)
060.            : base(viewContext, initializer, viewData)
061.        {
062.            this.AllowEmpty = false;
063.        }
064. 
065.        publicboolAllowEmpty { get; set; }
066. 
067.        publicoverridevoidWriteInitializationScript(TextWriter writer)
068.        {
069.            Dictionary<string, object> dictionary = newDictionary<string, object>(this.Events);
070. 
071.            dictionary["allowEmpty"] = (object)this.AllowEmpty;
072. 
073.            stringstr = "#";
074.            if(this.IsInClientTemplate)
075.                str = "\\"+ str;
076.            IDictionary<string, object> json1 = this.Animation.ToJson();
077.            if(json1.Keys.Any<string>())
078.                dictionary["animation"] = json1["animation"];
079.            if(this.ARIATemplate.HasValue())
080.                dictionary["ARIATemplate"] = (object)this.ARIATemplate;
081.            if(this.Culture.HasValue())
082.                dictionary["culture"] = (object)this.Culture;
083.            dictionary["format"] = (object)this.Format;
084.            if(this.ParseFormats.Any<string>())
085.                dictionary["parseFormats"] = (object)this.ParseFormats;
086.            dictionary["min"] = (object)this.Min;
087.            dictionary["max"] = (object)this.Max;
088.            if(this.EnableFooter)
089.            {
090.                if(this.FooterId.HasValue())
091.                    dictionary["footer"] = (object)newClientHandlerDescriptor()
092.                                                       {
093.                                                           HandlerName = string.Format("jQuery('{0}{1}').html()", (object)str, (object)this.FooterId)
094.                                                       };
095.                elseif(this.Footer.HasValue())
096.                    dictionary["footer"] = (object)this.Footer;
097.            }
098.            else
099.                dictionary["footer"] = (object)this.EnableFooter;
100.            if(this.Depth.HasValue())
101.                dictionary["depth"] = (object)this.Depth;
102.            if(this.Start.HasValue())
103.                dictionary["start"] = (object)this.Start;
104.            this.MonthTemplate.IdPrefix = str;
105.            IDictionary<string, object> json2 = this.MonthTemplate.ToJson();
106.            if(json2.Keys.Any<string>())
107.                dictionary["month"] = (object)json2;
108.            if(this.Dates.Any<DateTime>())
109.                dictionary["dates"] = (object)this.Dates;
110.            if(this.DisableDates != null&& this.DisableDates.Count<string>() > 0)
111.                dictionary["disableDates"] = (object)this.DisableDates;
112.            elseif(this.DisableDatesHandler != null)
113.                dictionary["disableDates"] = (object)this.DisableDatesHandler;
114. 
115.            writer.Write(this.Initializer.Initialize(this.Selector, "MyDatePicker", (IDictionary<string, object>)dictionary));
116. 
117.            base.WriteInitializationScript(writer);
118.        }
119.    }
120.}

 

 


ILMerge.Merge: The assembly 'Telerik.Documents.SpreadsheetStreaming' was not merged in correctly.

$
0
0
Hi Brian,

The files you have downloaded are the right ones - Telerik Document Processing was initially distributed with the UI for WPF suite and I am afraid that the build documentation and file names are still not updated. Just to ensure we are on the same page, the archive containing the source of the Document Processing libraries is named Telerik_UI_For_WinForms_[version]_DPL_source.zip.

I tested both sources - of UI for WinForms and of Telerik Document Processing - and managed to build them successfully and merge the outputted binaries. Could you please send us more information about the scenario? Which is the version of Visual Studio you use? Can you also share the command you are using to merge the assemblies?

Regards,
Tanya
Progress Telerik

Sorting on multiple columns not working

$
0
0

I have been brought in rather late to a project and am trying to get the system stable until I can rewrite it.

We have a grid where I have set in the options

sortable: { mode: "multiple", allowUnsort: true,  showIndexes: true  }

However, we can only ever sort by a single column. No matter what I've tried, it's always a single column.

What can I look at to start troubleshooting why sorting is always single?

ILMerge.Merge: The assembly 'Telerik.Documents.SpreadsheetStreaming' was not merged in correctly.

$
0
0

Hello Tanya, yes, I am using the DPL source in the WinForms download.

Running VS2017 Enterprise Edition and have .NET thru v4.7 installed.

 I tried to run the command line version of ILMerge and kept getting errors. Adding it to the projects .csproj I was able to merge the dll's with the exception of the one noted above.

Here is how I am running the command to merge;

<UsingTaskTaskName="ILMerge.MSBuild.Tasks.ILMerge"AssemblyFile="$(SolutionDir)\packages\ILMerge.MSBuild.Tasks.1.0.0.3\tools\ILMerge.MSBuild.Tasks.dll"/>
<TargetName="AfterBuild">
  <ItemGroup>
    <MergeAsmInclude="$(OutputPath)$(TargetFileName)"/>
    <MergeAsmInclude="$(OutputPath)BnsfLib.dll"/>
    <MergeAsmInclude="$(OutputPath)TelerikExport.dll"/>
    <MergeAsmInclude="$(OutputPath)TelerikData.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.WinControls.GridView.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.WinControls.Themes.Windows8.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.WinControls.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.WinControls.UI.dll"/>
    <MergeAsmInclude="$(OutputPath)TelerikCommon.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.Documents.SpreadsheetStreaming.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.Windows.Documents.Core.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.Windows.Documents.Fixed.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.Windows.Documents.Spreadsheet.dll"/>
    <MergeAsmInclude="$(OutputPath)Telerik.Windows.Zip.dll"/>
  </ItemGroup>
  <PropertyGroup>
    <MergedAssembly>$(ProjectDir)$(OutDir)CTCStatistics.exe</MergedAssembly>
  </PropertyGroup>
  <MessageText="ILMerge @(MergeAsm) -> $(MergedAssembly)" Importance="high" />
  <ILMergeInputAssemblies="@(MergeAsm)"OutputFile="$(MergedAssembly)"TargetKind="SameAsPrimaryAssembly"Closed="true"/>
</Target>

HTML5 ReportViewer not exporting to PDF according to Report orientation settings

$
0
0
Hi Matt,

It seems that setting PaperKind property to LetterRotated will be sufficient to display the report in landscape format. There is no need to set Landscape to true in this case.
Landscape=true will switch the width and height of the page.


Regards,
Katia
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items

RadGridView cause memory leak when disposed in RadPane without bringing it to view

$
0
0
Hi,

I looked through the given files, but I cannot to surely relate the observed leak to a known memory issue. However, I noticed that the view that displays path to GC.Root contains an instance of Timer as a retainer for RadGridView. Can you please confirm whether you have any custom timers in your application logic. Additionally, there are few timers that are used in RadGridView's logic. Two of them are enabled by default: one is related to text search and the other to property changed aggregation. Can you please try setting CanUserSearch and IsPropertyChangedAggregationEnabled to false and check whether there is any change in the memory footprint?

Regards,
Ivan Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.

ILMerge.Merge: The assembly 'Telerik.Documents.SpreadsheetStreaming' was not merged in correctly.

$
0
0
Tanya, I re-extracted the source code files and was able to compile them without errors.

Wpf Report Viewer & Implicit Styles

$
0
0
Hi Greg,

Telerik.ReportViewer.Wpf.xaml can be added manually from the product installation folder or by using the item template provided in Visual Studio. Please check the following tutorials that describe the detailed steps:
WPF report viewer manual setup
How to: Add report viewer to a WPF application


Regards,
Katia
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items

"VM74214:2 Uncaught SyntaxError: Invalid or unexpected token .. " when adding a column with client template to a details grid

$
0
0

Hi,

please find attached a demo project that demonstrates the problem. Please do not mind the name of the project and the solution - they were intended for a different problem ..

As soon as you run the project and expand any of the rows in the grid you will get the error in the browser console.

Regards,

Kiril

Sorting on multiple columns not working

$
0
0
We found the issue - it had nothing to do with Kendo. They were saving settings & reapplying them, overwriting the entire grid. 

Export DOCX to PDF with images

$
0
0

Im having same same problem when trying to convert a docx (having logo/clip art images) to pdf. The backcolor of the images are turning black. Is there any solution for this? 

Is there anyway i can convert those problematic images to png during conversion? 

Here is my code,

 var fileFormatProvider = new DocxFormatProvider();
                var document = new RadFlowDocument();

string pdfFilename = string.Empty;

                using (FileStream input = new FileStream(docxReportfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    document = fileFormatProvider.Import(input);
                }

                byte[] renderedBytes = null;
                IFormatProvider<RadFlowDocument> formatProvider = new PdfFormatProvider();

                using (MemoryStream ms = new MemoryStream())
                {
                    formatProvider.Export(document, ms);
                    renderedBytes = ms.ToArray();
                    pdfFilename = Path.ChangeExtension(docxReportfile, ".pdf");
                    SysFile.WriteAllBytes(pdfFilename, renderedBytes);

 

Export DOCX to PDF with images

$
0
0
Im using the version 2015.3.1322.40

Legend- DataTable

$
0
0
Hello,

I'm trying to load a pie chart from a datatable dynamically.

I created a new ChartSeries and added it to the chart.

I have the following columns: Total and Account

The total column I am loading as follows:

Serie.DataYColumn = "Total"
Series.DefaultLabelValue = "#% {# 0. ##%}"
Serie.Type = Foot

: I would now like to display the values of the Account column in the caption

series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels

How do I display the Account column in the Legend?

From now on,

Automatic translation

The 'Wait for condition has timed out' exception is occurred

$
0
0

Hi, I'm using Telerik in a page which call multiple libraries, the time for response is between 30 seconds and 3 minutes. When this libraries pass the 1m to response, Telerik show message the error like this:

 

System.TimeoutException: Wait for condition has timed out
  at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo, Object target)
  at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout, WaitResultType errorResultType)
  at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout)
  at ArtOfTest.WebAii.Core.Browser.WaitUntilReady()
  at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
  at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request)
  at ArtOfTest.WebAii.Core.Browser.InternalNavigateTo(Uri uri, Boolean useDecodedUrl)
  at ArtOfTest.WebAii.Core.Browser.NavigateTo(Uri uri, Boolean useDecodedUrl)
  at ArtOfTest.WebAii.Core.Browser.NavigateTo(String url, Boolean useDecodedUrl)

 

Can I configure a maximum timeout to waited for the load complete of the page? 

The navigation of my page is dynamic, sometime to URL (ActivateBrowser.NavigateTo(...)) and sometime do it click in elements, for this reason I need a change global and not only how parameter by each redirect

Thanks

ListView not showing up

$
0
0
Hi San,

You no longer need to declare the renderers, or call TelerikForms.Init(), after version 2017.1 . We now do this internally to make this easier for you (please see this doc article for more info).

Since you haven't shared your code, I can't tell exactly what's wrong, but a very common cause for not seeing the radListView is that you put it inside a StackLayout. Instead put the RadListView inside a Grid.

If you need RowDefinitions, than make sure the RadListView is inside a RowDefinition that has a height of star.

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
 
    <OtherContent Grid.Row="0" />
 
    <RadListView Grid.Row="1"/>
</Grid>

If you're still having trouble, please open a support ticket here and share your code so that we can investigate directly.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items

DrawerContent scroll

$
0
0
Hello Sebastian Soto,

If you use a scrollable element inside the DrawerContent, it will scroll. For example a RadListView or ScrollView.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items

Converting DataSourceRequest filters to SqlServer parameterized query in controller Read method

$
0
0

For the use case of a remote data source delivering json to a grid one would typically use a simple combination of an entity framework object using extension method ToDataSourceResult.  For example: 

using Kendo.Mvc.Extensions;
 
namespace MyProject.Controllers
{
    public partial class MyDataEditorController : Controller
    {
        public ActionResult MyData_Read([DataSourceRequest]DataSourceRequest request)
        {
            DataSourceResult result = db.MyData.ToDataSourceResult(request, myData => new {
                MyDataID = myData.AnalysisID,
                ...
            });
 
            return Json(result);
        }

 

ToDataSourceResult() takes care of inspecting the request and applying the supplied criteria for filtering, sorting, grouping, paging, etc... to create an EF query in the connected database.

What happens if the database object being queried does not have an EF model ? 

The above pattern of coding can not be used.

The lack of an EF model could be by design oversite, or the object is dynamic in nature.  A dynamically constructed pivot view can not be compile time modeled for EF.  The following method shows how the DataSourceRequest filter data is used to construct a parameterized where clause for a query in SqlServer.  Slight modifications may be needed for other target data bases:

privatestringDescriptorToSqlServerQuery (FilterDescriptor fd, SqlCommand command)
{
    stringparameterName = "@PARAMETER"+ command.Parameters.Count;
    stringresult;
 
    // Some string filter values are modified for use as parameteres in a SQL LIKE clause, thus work with a copy.
    // The original value must remain unchanged for when ToDataSourceResult(request) is used later.
 
    Object filterValue = fd.Value;
 
    switch(fd.Operator)
    {
        caseFilterOperator.IsLessThan:             result = "["+ fd.Member + "]"+ " < "+ parameterName; break;
        caseFilterOperator.IsLessThanOrEqualTo:    result = "["+ fd.Member + "]"+ " <= "+ parameterName; break;
        caseFilterOperator.IsEqualTo:              result = "["+ fd.Member + "]"+ " = "+ parameterName; break;
        caseFilterOperator.IsNotEqualTo:           result = "["+ fd.Member + "]"+ " <> "+ parameterName; break;
        caseFilterOperator.IsGreaterThanOrEqualTo: result = "["+ fd.Member + "]"+ " >= "+ parameterName; break;
        caseFilterOperator.IsGreaterThan:          result = "["+ fd.Member + "]"+ " > "+ parameterName; break;
        caseFilterOperator.StartsWith:
            filterValue = fd.Value.ToString().ToSqlSafeLikeData() + "%";
                                                    result = "["+ fd.Member + "]"+ " like "+ parameterName; break;
        caseFilterOperator.EndsWith:
            filterValue = "%"+ fd.Value.ToString().ToSqlSafeLikeData();
                                                    result = "["+ fd.Member + "]"+ " like "+ parameterName; break;                   
        caseFilterOperator.Contains:
            filterValue = "%"+ fd.Value.ToString().ToSqlSafeLikeData() + "%";
                                                    result= "["+ fd.Member + "]"+ " like "+ parameterName; break;
        caseFilterOperator.IsContainedIn:
            thrownewException("There is no translator for ["+ fd.Member + "]"+ " "+ fd.Operator + " "+ fd.Value);
        caseFilterOperator.DoesNotContain:
            filterValue = "%"+ fd.Value.ToString().ToSqlSafeLikeData();
                                                    result = "["+ fd.Member + "]"+ " not like "+ parameterName; break;
        caseFilterOperator.IsNull:     result = "["+ fd.Member + "]"+ " IS NULL"; break;
        caseFilterOperator.IsNotNull:  result = "["+ fd.Member + "]"+ " IS NOT NULL"; break;
        caseFilterOperator.IsEmpty:    result = "["+ fd.Member + "]"+ " = ''"; break;
        caseFilterOperator.IsNotEmpty: result = "["+ fd.Member + "]"+ " <> ''"; break;
        default:
            thrownewException("There is no translator for ["+ fd.Member + "]"+ " "+ fd.Operator + " "+ fd.Value);
    }
 
    command.Parameters.Add(newSqlParameter(parameterName, filterValue));
 
    returnresult;
}

is called from this method

privatestringFiltersToParameterizedQuery(IList<IFilterDescriptor> filters, FilterCompositionLogicalOperator compositionOperator = FilterCompositionLogicalOperator.And, SqlCommand command = null)
{
 
    if(!filters.Any()) return"";
 
    stringresult = "(";
    stringcombineWith = "";
 
    foreach(var filter infilters)
    {
        if(filter isFilterDescriptor fd)
        {
            result +=
                combineWith + "("
                + DescriptorToSqlServerQuery(fd, command)
                + ")"
                ;
        }
        elseif(filter isCompositeFilterDescriptor cfd)
        {
            result +=
                combineWith + "("
                + FiltersToParameterizedQuery(cfd.FilterDescriptors, cfd.LogicalOperator, command)
                + ")"
                ;
        }
 
        combineWith =
            (compositionOperator == FilterCompositionLogicalOperator.And)
            ? " and "
            : " or "
            ;
    }
     
    result += ")";
    returnresult;
}

Which is utilized by this read method that applies the data of the DataSourceRequest in the making of a 'manual' query

        public ActionResult MyData_Read(DataSourceRequest request)
        {
            // KendoUI Grid, Custom binding - https://docs.telerik.com/aspnet-mvc/helpers/grid/binding/custom-binding
            // db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
 
            SqlCommand command = new SqlCommand();
 
            string whereClause = FiltersToParameterizedQuery(request.Filters, command: command);
            string orderClause = "";
            string pageClause =
                " OFFSET " + (request.Page-1)*request.PageSize + " ROWS"
                + " FETCH NEXT " + request.PageSize + " ROWS ONLY"
                ;
 
            string apv1stColName = chemistryColumns[0].ColumnName;
            List<string> orderedMembers = new List<string>();
 
            string comma = "";
            if (request.Groups != null)
            {
                foreach (var group in request.Groups)
                {
                    if (orderedMembers.Contains(group.Member)) continue;
 
                    orderClause += comma
                        + group.Member
                        + ((group.SortDirection == System.ComponentModel.ListSortDirection.Ascending) ? " ASC" : " DESC");
 
                    comma = ",";
                    orderedMembers.Add(group.Member);
                }
            }
            if (request.Sorts != null)
            {
                foreach (var sort in request.Sorts)
                {
                    if (orderedMembers.Contains(sort.Member)) continue;
 
                    orderClause += comma
                        + sort.Member
                        + ((sort.SortDirection == System.ComponentModel.ListSortDirection.Ascending) ? " ASC" : " DESC");
 
                    comma = ",";
                    orderedMembers.Add(sort.Member);
                }
            }
 
            if (!orderedMembers.Contains(apv1stColName))
            {
                orderClause += comma + apv1stColName + " ASC";
            }
 
            if (whereClause.Length > 0) whereClause = " WHERE " + whereClause;
            if (orderClause.Length > 0) orderClause = " ORDER BY " + orderClause;
 
// --- connect and execute page query and count all rows per filter
 
            string pageQuery = "select * from MY_UNMODELED_DATABASE_OBJECT" + " " + whereClause + orderClause + pageClause;
            string countQuery = "select count(1) from MY_UNMODELED_DATABASE_OBJECT" + " " + whereClause;
 
            var dataTable = new System.Data.DataTable();
            int total = 0;
 
            using (var connection = new SqlConnection(db.Database.Connection.ConnectionString))
            {
                command.Connection = connection;
                command.CommandText = pageQuery;
 
                using (var dataAdapter = new SqlDataAdapter(command))
                {
                    dataAdapter.FillSchema(dataTable, System.Data.SchemaType.Mapped);
                    dataAdapter.Fill(dataTable);
                }
 
                command.CommandText = countQuery;
                total = (int) command.ExecuteScalar();
            }
 
// --- a little fakery to request.Page to make things work in ToDataSourceResult()
 
            request.Page = 1;
            DataSourceResult result = dataTable.ToDataSourceResult(request);
            result.Total = total;
 
            return Json(result);
        }

 

Enjoy and happy coding.

Grid Data based on DropDownList

$
0
0

Thanks.  While your response was not the exact answer I was looking for, it was enough to spark my memory of how I did it before.  Very similar.

When the user selects an option in the drop down, I set a javascript variable, and in the Grid as part of it's Read action I have a .Data("scriptFunction") which builds an appropriate JSON object with the upload label I want from that variable.  Next step is to convert it to a MVVM viewModel, but so far it's working as I expect it to.

ListView Invalid Template When Using Apostrophes

$
0
0

I am getting an invalid template error when I am creating a ListView in which the Editor Template contains a select list that is bound to a datasource that contains elements with an apostrophe.  It looks like the text is getting escaped, as the error message shows it being created as "<option value="Conveners&#x27; Corner (New)">Conveners&#x27; Corner (New)</option>", but I don't know if it's Kendo doing the escaping or MVC or something else.  This encode contains a # sign though, and that doesn't get escaped, which causes the error.

Is this a bug with the ListView control?  Is there some other event where I can escape the escaped text to put a \\ before an # characters?

2017.2.621 security update

$
0
0
The Update Wizard worked for me too.
Viewing all 84751 articles
Browse latest View live