DNN How to create a complex module with multiple controls - c#

My goal are to create a module that holds a listview with entries of xml files. The xml files are just serialized arrays of some object. Country{Code,Name,URL} as an example.
When an entry is clicked another control should show all the items in some kind of item control with styling based on the type(The idea are from WPF). I assume its possible to create some kind of style/rules for possible item types, in above case Country. (any ideas/advises on how to achieve this is welcome).
Now in the list of styled items, one should be able to select wanted items, and export this to a new XML file based on a new type SelectedContries{Code,Name,Url, Params}. The user will then need to add in the extra params in the new list and export(serialize).
My question is now, to do such module what would be the proper way. One module with 3 controls. I am new to module development so please explain deeply. Do i create Asxc files within the module as my controls?
Based on my explained goal above, any links to guides that might be good for exactly this would be nice and any general advises are also welcome. Thanks.

if I got you right, that you want to have a grid on your module showing all your country entries read out from a xml file.
The user can edit or add some detail information to those entries and export (serialize) it again into xml.
I would use the implemented Telerik Grid RadGrid (DNN wrapper is called "dnnGrid") to show all xml items in a grid on your module.
Then I would enhance the grid for your special needs adding some new columns or edit the existing (dont know exactly what you want to edit in this grid).
The last step is to serialize the entries again this should be done with a extra button calling the serialize method.
These are rly basic ideas from me. Iam a dnn module developer I think I could help you better if you explain it to me a lil detailed, show me a bit of the xml file and so on.
best regards, noone

Related

Grapecity Active reports databinding from Code Behind

I have a .rpx file, which I want to bind data from one of my class library projects in C# and generate a PDF file out of it and save it to a specific location. I am able to bind the textbox that is in the page header. The issue that I am facing is in the detail section of the reports where I want to bind repetitive data. The detail section has textboxes, which I want to bind with the properties in the Object.
In short, would need to bind a list of object to the detail grid. So could someone let me know the best approach I can take for this?
The best approach to this is to either bind your data to a DataSet or a DataReader. Please refer to the Bound Data Sample that shows this as well as some other methods of data binding.
Sample Documentation: https://www.grapecity.com/activereportsnet/docs/v14/online/ar-sam-bound-data.html
Sincerely,
The GrapeCity Support Team
https://www.grapecity.com/support/contact

Saving Dynamically Added C# WinForms Controls

How do I go about saving dynamically added WinForms controls?
My application should be able to do this for the following: TabPage, GroupBox, RadioButton, and CheckBox. The RadioButton and CheckBox both correspond to a block of text that will be outputted when selected. I understand the process would consist of creating the controls first and storing them, but I am unsure whether what I have found so far (listed below) are the most apt ways to go about doing so.
Creating the Controls
The topic I linked suggested the use of objects that inherit from specific controls. This means I should just instantiate such objects as needed and assign the dynamic values accordingly. It appears to be the easiest way to do this step unless someone suggests otherwise.
Storing Controls
For this part, I was thinking of:
A. Database
My application uses SQLite to save the text and the control properties could also be saved into and retrieved from it via a method from the aforementioned classes.
B. XML
Perhaps a configuration file that I will make myself to write and read from? Tutorials seem aplenty on how to process XML, which makes it doable for me. I am unsure, however, whether storing lengthy text is advisable here, and likewise for what follows.
C. Serialization
Researching got me 3 results--JSON, XmlSerializer, and BinaryFormatter--all of which I have not had experience with as far C# is concerned. There seems to be difficulty in deserializing controls, and each control needs to be serialized differently.
D. UserSetting
This appears to be similar to XML, only that it uses StringCollection or Settings.setting instead.
Suggestions, recommendations, or corrections anyone?

C# Populate ReportViewer from arrays (High Level)

I'm going to build a few arrays and want to populate a rdlc report from them, but want to make sure I've got the high level process down before I start coding. I'm populating these arrays from calculations based on foxpro (sigh...) tables.
Do I need to create the report first through the wizard and throw generic columns in there, then adjust as necessary? Or can the code completely do everything? Previously, when I tried to do this through code-only, the Report.Refresh() wouldn't actually launch the report...
So:
Create Report with generic columns and modify as necessary later
Populate arrays
Stuff arrays into report and display?
Remember, I'm looking for a high-level process flow right now, there are tons of code examples on each individual element I'm just not sure I've got the process right.
Thanks in advanced.
After much research and fumbling around, I finally got it to work on my own...so if anyone else stumbles across this, here is what worked for me. I'm certain there are better ways to do this.
Populate Arrays as necessary
Create Data Set with a data table as defined
Populate dataset.datatable with arrays
Create report.rdlc using datatable from step 3
If using WPF, add the WinForms control to your WPF application
Stuff datatable in to datasource (reportdatasource.value = dataset.datatable)
Give reportviewer the embedded resource of your report
Refresh
????
Profit!

Create a report with its respective chart from a chosen LINQ query in C#

I'm quite busy reading different posts over how to create reports from dynamic queries. I have the next problem and maybe someone here can help me with this:
I have a class where I can create a dataGridView from a dynamic dataTable in a project made with C# from VS 2010. I populate my DataTable with one of 9 different linq queries that I have according to the user requirements, which also are saved in a register in my database. Starting from this point, I need to make a report where I can show of the same way the data selected.
I have found the code from the website got ReportViewer and it works quite good. Only I have a last problem. I need my report to show a chart according to the parameters passed via the DataTable. I saw the examples that they have there for the charts but they work quite restrict with what I need, and the code for the chart generator that is incluided in the Dynamic Table project is quite extense and a bit complex for a beginner like me.
Do you know any other examples that maybe I can find to use to make the code in my project? Many thanks in advance :).
I found another way to do it:
Now I'm using classes as datasources and filling arrays of these classes with the contect of the datatable.
I pass these arrays as my datasources for the project.
I group my data by the number of fields I want to display and then I choose between pre made .rdlc files where I show my data to the user.

Preset html files built into program?

I'm trying to create a very basic web site creator in C#. I already created the templates but have no idea how to get them in the program so the user can pick one and customize it. Is there a certain library I should look into? I've bee told this can be easily created in php but I'd rather not go down that route.
If using .NET you can use WebControl controls to display a preview of your templates and make the user decide which one he wants.
Or a list of templates and single WebControl that parse and display the HTML of the current selected list item (template) and then make the user select.
To edit, just a bunch of controls (one for each template placeholder) that updates the view of the WebControl.
In the top link you found how to do it.
P.S. Templates can be stored on XML, Plain Text, DB or any other mean.
Either store the templates as files on the web-side and use them as templates, or store them in a DB. Unless your app is not web-based, in which case the same advice pretty much applies.

Categories