Syncfusion WPF ReportWriter - How to set ReportParameters - reporting-services

I'm migrating a few reports from SSRS to Syncfusions's Reports. However, what I cannot seem to get to work is passing in parameters to the WPF ReportWriter.
I'm using this code:
ReportWriter reportWriter = new ReportWriter(reportPath);
List<ReportParameter> parms = new List<ReportParameter>();
parms.Add(new ReportParameter() { Name = "OrderId", Values = { "23456" }, Labels = { "test" } });
reportWriter.SetParameters(parms);
reportWriter.Save(#"c:\rdl\paul.pdf", WriterFormat.PDF);
It completely ignores the parameter, and does its own thing. None of the samples show this, and the documentation is basically non-existent. Perhaps someone else has experience of this?
Thanks,
Paul

This issue was resolved in syncfusion latest release version .
Thanks ,
Ragavan

Related

How to get client side data from Kendo Grid to controller

I am trying to get Kendo Grid data which is hydrated from client side to a MVC controller method. My view contains several single fields like name, date of birth etc and tabular field which I hooked with a Kendo Grid. Since its a new operation I have no data in the grid ( and other fields) and user enters them from client side.
I have no idea how to proceed on this. Ideally I would like to get this data to a list in my viewmodal. So that when the user hits save, I have all other data and the grid data coming into a controller method.
I am able to successfully bind a list with kendo grid and display it. I have very little experience on JavaScript and Kendo and web programming.
If any of you can point me to the right direction, sample code would be greatly appreciated.
$("#departmet").kendoGrid({
dataSource: dataSource,
height: 250,
scrollable: true,
sortable: true,
filterable: true,
pageable: {
input: true,
numeric: false
},
columns: [
"DepartmentName",
"SubDivision"
]
});
From experience I know their documentation is not easy to navigate. It seems there is the documentation and then the API. The API is usually what you will always want to find. What you will need is the information from here https://docs.telerik.com/kendo-ui/api/javascript/ui/grid. If I understand the question correctly. There are several ways you can achieve posting. You could make use of editor templates. Click the Open in Dojo to get an idea how it looks.
https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/editable.template
With this you do not have to worry about modifying the data via javascript. Assuming your grid is surrounded with a form element it will get posted when submitted. Note paging is not accounted for here. Also, this method by default can auto post after each edit. If you don't want this behavior then you will have to have advanced knowledge of the API.....Correction on that last statement. The API is different when dealing with the data all on the client side. Click the Open in Dojo to see it all on the client side. If you are not wanting to use editor templates and want to manage the data editing yourself then you need to use the grid methods provided.
Once you have your grid created. To access the data source of the grid you will need to get the dataSource.
$('#departmet').data('kendoGrid').dataSource;
https://docs.telerik.com/kendo-ui/api/javascript/data/datasource
If you need to use a different data source(or change it) you can use the setDataSource method below(grid function).
https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/methods/setdatasource
To add to the data source use the add function to add a new object.
$('#departmet').data('kendoGrid').dataSource.add({ id: 2, name: 'name'});
https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/methods/add
It is important with kendo to ALWAYS use the methods provided to change the data source so that the proper events can fire to update the UI accordingly. This includes if you need to set a property on a specific data item. In that case you need to use the set method on the item itself.
After you are done modifying your data. Within javascript get the data and either create DOM elements within a form
//JQuery sudo code example
var data = $("#departmet").data("kendoGrid").dataSource.data();
var dataLen = data.length;
var myForm = $('#my-form'); //Already within DOM
for (var i = 0; i < dataLen; i++) {
var item = data[i];
var idEl = $('<input type="hidden" name="userData[' + i + '].id" />');
idEl.val(item.id);
var nameEl = $('<input type="hidden" name="userData[' + i + '].name" />');
nameEl.val(item.name);
myForm.append(idEl);
myForm.append(nameEl);
}
myForm.submit();
This assumes your controller function(??) on the backend is expecting an array of objects with the property name of userData.
Alternatively, you can post it via ajax. For example, the ajax jquery function. Passing your data as the data of the ajax call.
http://api.jquery.com/jquery.ajax/
Don't want to ramble. Let me know if you need more help.
SO won't let me comment yet so have to add another answer. You will not need to define the data source within the .NET code when dealing with client only data. Just use this.
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
)
If you will have data coming from the backend then you need to use the generic-less constructor and pass in the object else keep what you have.
Html.Kendo().Grid(Model.MyList)
However, if you are preprocessing some client data on the screen that you want to initialize then you will need to do this on ready. Don't worry about the schema part of the data source. It already knows this when you used the .NET MVC wrapper because you gave it the schema(type) via the generic or the parameter provided.
var initialDS= new kendo.data.DataSource({
data: [
{ ActionName: "Some Name", ActionType: "Some Type" }
]
});
$(document).ready(function () {
$('#docworkflow').data('kendoGrid').setDataSource(initialDS);
});
As I mentioned in the other answer. Use the data source functions for adding additional data to the data source. No need to setDataSource each time you want to add. Just
//Assuming you have 2 inputs on the screen the user is entering info into
var nameEntry = $('#action-name').val();
var typeEntry = $('#action-type').val();
$('#docworkflow').data('kendoGrid').dataSource.add({ ActionName: nameEntry , ActionType: typeEntry });
So after some efforts I come up with. But I don't know where to specify the
data in the html code. Is it possible this way?
#(Html.Kendo().Grid <DockData.Action> ()
.Name("docworkflow")
.Columns(columns =>
{
columns.Bound(e => e.ActionName);
columns.Bound(e => e.ActionType);
}).DataSource( **How do I load a script variable here***)
//This script variable should be fed to the above code.
This variable is populatedwhen the user adds data from the UI which works fine.
var dataSource = new kendo.data.DataSource({
data: result,
schema: {
model: {
fields: {
ActionName: { type: "string" },
ActionType: { type: "string" }
}
}
},
pageSize: 20
});

How to add Telerik Report Book into C# Report Libarary

I am using telerik report trial version and would like to club two report into a single report using Report Book feature but unfortunately not able to found option to add it in the C# Report Library.
I have created "Report Book" using telerik standalone designer tool but don't know how do i convert into C# Report library.
I would appreciate if you could give me some advice.
I advise you to use code behind from book report. You can access by pressing f7 from designer.
An example to club two reports using code behind:
public class ExampleBookReport : Telerik.Reporting.ReportBook
{
/* data source to your reports */
public ExampleBookReport (DataSourceModel dataSource)
{
/* adding report 1 */
var instanceReportSource = new InstanceReportSource() { ReportDocument = new ExampleReport1(dataSource) };
ReportSources.Add(instanceReportSource);
/* adding report 2 */
var instanceReportSource2 = new InstanceReportSource() { ReportDocument = new ExampleReport2(dataSource) };
ReportSources.Add(instanceReportSource2);
}
}

Getting value of Bootstrap TouchSpin

I am using the bootstrap touchspin script from http://www.virtuosoft.eu/code/bootstrap-touchspin/.
Everything works quite well to set the value - but I'm struggling to find out how to retrieve the newest value when I stop downspinning. If I am not wrong, the doc is not mentioning that either. Also, using Google and this site, I did not find out any answer on how to solve my issue.
var i = $("input[name='demo7']"),
demoarea = $("#demo7textarea"),
text = "";
i.on("touchspin.on.stopspin", function () {
writeLine("touchspin.on.stopspins" + "new value " + i.value );
});
What am I missing? I hope my question is clear.
Many thanks for your help.
Finally, I got the answer from the developer.
Should be :
... $(this).val() instead of i.val()

p:lineChart - continuous line, without dots

how to remove the dots from p:lineChart and draw the chart as just the continuous line?
Thanks
For others with similar problem, I did:
<p:chart type="line" model="#{myController.model}"/>
and:
LineChartSeries serie = new LineChartSeries();
serie.setShowMarker(false);
and worked fine. I'm using PrimeFaces 5.1.
There is a showMarkers attribute that isn't working for me (I'm using PrimeFaces 3.4.2) but I found a way to hide them.
It's a bit hacky, I made it working on the showcase, you just need to replace widget_category by the widget of your chart. You can even test it online from the showcase using a javascript console if your web browser allows it (tested under chromium) :
// loop through the series
for (var i = 0; i < widget_category.cfg.series.length; ++i) {
// Hide markers
widget_category.cfg.series[i].showMarker = false;
// I'm not sure you want this when talking about 'continuous line'
// but you can make your chart smooth this way :
widget_category.cfg.series[i].rendererOptions = { smooth: true };
}
// Ask a refresh using the modified configuration object
widget_category.refresh(widget_category.cfg);

SSRS date-picker is invisible in Google Chrome, not working in Opera/IE?

I'm integrating SSRS reports(developed in VS 2008 vs. 9.0 ), and when I load it into the browser with Chrome, I get this:
There's no date-icon!
In Opera it shows, but doesn't work:
How do I figure out how to 1.) get it to work correct . 2) Make it visible in Chrome
I found a site talking about it( here ) , but it only hhas a dead-link ( http://www.rajbandi.net/ )
Is it just me or is this a complex issue to fix? Any tips appreciated
Maybe this post will be helpful for you?
http://www.codeproject.com/Articles/504567/Print-button-Date-picker-in-SSRS-Reports-for-Non-I
The supposedly dead link (rajbandi.net) was accessible at the time of writing this post; I'm putting its contents here for use if the link is down again:
Fixing SSRS Report Viewer control date picker in Google chrome
Author: Raj Bandi
April 3, 2012
https://rajbandi.net/2012/04/03/fixing-ssrs-report-viewer-control-date-picker-in-google-chrome/
SSRS Report Viewer control works well in IE6+ but has some known compatibility issues with other major browsers(Firefox, Chrome etc.) around date picker and print button.
For more information read this
http://msdn.microsoft.com/en-us/library/ms251673.aspx
I am presenting a simple solution to fix date picker issue in Chrome with a combination of some server side code and Client side JQuery script.
Server Side Code
1) Add the below code in the page/control file in which the reportviewer control resides
<asp:HiddenField ID="DatePickers" runat="server" />
2) Add the below code in the code behind file of page/control in which the reportviewer control resides(.Net 2.0 version)
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
DatePickers.Value = string.Join(",",(new List(GetDateParameters()).ToArray()));
}
private IEnumerable GetDateParameters()
{
// I'm assuming report view control id as reportViewer
foreach (ReportParameterInfo info in reportViewer.ServerReport.GetParameters())
{
if (info.DataType == ParameterDataType.DateTime)
{
yield return string.Format("[{0}]",info.Prompt);
}
}
}
Client Side Code
1) Add the below script in the html head section
$(document).ready(function(){
if ($.browser.webkit)
{
$($(":hidden[id*='DatePickers']").val().split(",")).each(function(i, item) {
var h = $("table[id*='ParametersGrid'] span").filter(function(i) {
var v = "[" + $(this).text() + "]";
return (v != null && v.indexOf(item) >= 0);
})
.parent("td").next("td").find("input")
.datepicker({
showOn: "button",
buttonImage: '/Reserved.ReportViewerWebControl.axd?OpType=Resource&Name=Microsoft.Reporting.WebForms.calendar.gif',
buttonImageOnly: true,
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true
});
});
}
});
At least in Chrome, an option could be just to show the date excluding the time. This make more sense to the end user.
//Update the dates
$(document).ready(function () {
$('input[type=text]').each(function () {
$(this).val($(this).val().replace('12:00:00 AM', ''));
})
});
Removing current account/people and adding new account/people on chrome worked for me.