I couldn't find any solution regarding this matter. If anyone use Telerik and have any idea about this please post. :)
Currently I have an ojbect:
Absence
-> List<Available> Available
I was successfully pass the List object to the main table and list out the Absence object. However when i try to do something like the ff, I have a mental block and I could not find anyway either on google or on their documentation
------------------------------------------------------------
| ABSENCE |
------------------------------------------------------------
| Field1 | Field2 |
| |
| ----------------------------------------------------- |
| | Available | |
| ----------------------------------------------------- |
| | Available Field1 | Available Field2 | |
| ----------------------------------------------------- |
| |
|----------------------------------------------------------|
|----------------------------------------------------------|
| Field1 | Field2 |
| |
| ----------------------------------------------------- |
| | Available | |
| ----------------------------------------------------- |
| | Available Field1 | Available Field2 | |
| ----------------------------------------------------- |
| |
------------------------------------------------------------
I cannot find anyway to bind or change the datasource of the subTable to the corresponding sub object
How can I archive this kind of result?
Thank you
You'll want to use SubReports for this. You can read about them in Telerik's documenation or even read this help page that is specifically about master-detail reports which is like what you are doing.
Basically, you'll create two reports. The Master report will display all the Absence objects. As part of the 'detail' section of that report, you'll place a SubReport. The SubReport will show the second report which will list all the Available objects. Then you can pass a parameter from the master report to the sub report and use a filter so you only see the Availables that correspond to the passed in Absence.
Then remember that the outer report's Data Source should be all the Absences and the inner report's Data Source should be all the Availables.
I have had same problem a while ago.
I figured out that Telerik Reporting has some kind of bug with nested tables. If I put Table2 (child) as cell content of Table1 (parent) and try to bind data sources (via bindings or in code, no matter) than my child Table2 will always show the same item in all rows.
I try to ask in official Telerik forum about that but they just tell me to use SubReport (which, by the way, did not resolve my problem).
So I was forced to use List (Telerik Reporting control) as parent content holder. And as you understand it was hard to implement such markup as in Table control.
We have just done something slimier to this in a report today.
You can add a list control into the cell of the table. Using binding on the list, bind the dataSource to the property that contains the list. You can then Add Columns in you listbox to display the data.
We are doing this by assigning the table data source as an Object in C#. I assume you could do something similar if using SQL/other datasources by attaching the relevant datasource to the list box and applying a filter with a parameter.
Related
I am not very proficient at SQL yet. I'm learning, but it's a slow process. I am working on a project at work which stores a good deal of information in a database in SQL Server. In one of the tables, ContactInformation, we're experiencing an error when an attempt to modify an entry runs afoul because a nonclustered index composed of all of the address information exceeds 900 bytes. I've used sys.dm_db_index_usage_stats to verify that modifying an entry in the table leads to 3 user_seeks and 1 user_update.
The C# code does not seem to be directly calling the index. It executes a single DbCommand that consists of a stored procedure command of the Update variety with 19 parameters. My thoughts are to either eliminate the index or to try to break up the DbCommand into multiple updates with a smaller number of parameters in hopes of having a smaller index to work with.
I am a bit at sea due to my lack of experience. I welcome any advice on which way to turn next.
The Index consists of the following:
| Name | Data Type | Size |
|----------------------|---------------|------|
| ContactInformationID | int | 4 |
| CompanyID | smallint | 2 |
| Address1 | nvarchar(420) | 840 |
| Address2 | nvarchar(420) | 840 |
| City | nvarchar(420) | 840 |
| State | nvarchar(220) | 440 |
| PostalCode | nvarchar(120) | 240 |
| Country | nvarchar(220) | 440 |
Yes, most of the columns are oversized. We apparently inherited this database from a different project. Our software limits most of the columns to no more than 100 characters, although there are some outliers.
The index size limit only applies to the key columns. It applies to all B-Tree bases storage modes (NCI and CI). This limit exists to ensure a certain degree on tree fanout in order to bound the tree height.
If you don't need to seek on columns such as Address1 and Address2 (considering that they might be null as well) make those columns included columns.
The index key should never be longer than the shortest key prefix that results in a unique index. Every column after that never helps compared to that column being included.
If ContactInformationID is unique, which I have a feeling it very well could be, then having any other fields in the index is pointless.
Such an index is useful only for queries where the value of ContactInformationID is present as a query parameter, and when it is, the rest of the fields are immaterial.
I need an idea. I have an app, a winform having multiple tabs in it. There are a bunch of people using it, but none of them needs to use all the tabs, just a couple of them. I've reached a point where it's hard to handle from the source code, so I need a solution to easily manage the permissions. The best would be to use an SQL table for this as I also have to provide for another guy the possibility to modify the rights. I think it would be fine to simply remove the tabs by creating an sql table like this, and at the program startup simply query something like this:
select tabid from table where loggedinuser = 0
and then just loop through the result and remove all of them
foreach(tabid in tabids)
{
tabControl1.TabPages.RemoveByKey(tabid);
}
table:
+----------+----------+-------+-------+-------+
| tabid | name | user1 | user2 | user3 |
+----------+----------+-------+-------+-------+
| tabPage1 | project1 | 0 | 1 | 0 |
+----------+----------+-------+-------+-------+
| tabPage2 | project2 | 1 | 0 | 1 |
+----------+----------+-------+-------+-------+
| tabPage3 | project3 | 1 | 0 | 0 |
+----------+----------+-------+-------+-------+
However I somehow feel that this is not an elegant solution, especially because you have create a new column each time a new guy has to be added. Do you have any idea how to solve it?
I think this is an issue of the database's design, and a basic one; perhaps you need to improve your understanding of SQL databases, particularly relationships and primary/foreign keys. You shouldn't add new columns but new rows.
You need a table for the users, one for the tabs and one to connect the two. Such as this:
User:
+---------+------+
| user_id | name |
+---------+------+
| 1 | John |
+---------+------+
| 2 | Jane |
+---------+------+
Tab:
+--------+----------+
| tab_id | title |
+--------+----------+
| 1 | Articles |
+--------+----------+
| 2 | Products |
+--------+----------+
UserTab:
+---------+--------+---------+
| user_id | tab_id | enabled |
+---------+--------+---------+
| 1 | 1 | 1 |
+---------+--------+---------+
| 1 | 2 | 0 |
+---------+--------+---------+
| 2 | 1 | 0 |
+---------+--------+---------+
| 2 | 2 | 1 |
+---------+--------+---------+
In this example, John can only access Articles and Jane can only access Products.
You should get the ID of the current user and get the entries from UserTab, then remove the tabs that correspond to the IDs for which enabled=0.
You also should make a "default" choice for when the right combination of user and tab doesn't exist in the UserTab table: either display the tab by default or hide it by default.
If you do it through SQL, a simple data model could be :
USER TABLE would have fields user_id,username,... all USER related fields you wish
ROLE TABLE would have fields role_id,role_name
USERROLE TABLE would have fields f_user_id,f_role_id(both foreign keys)
Each record (line) in this table links a user to a role, so a user can have many roles, and a role can be attribuated to many users. That's called a many-to-many relationship
ROLERIGHT TABLE would have fields f_role_id,tabid
Each record (line) in this table links a role to a tab that this role has access to. That means if a role should access all tabs and you've got 10 tabs, you'll have 10 lines with the same role_id and a different tabid from 1 to 10. It is also a many-to-many relationship.
This is quite an usual database pattern for access right management I guess. Now what you have to do is define the several roles. And assign it to the different users. If a new user comes in and he should have the same rights as another user, you just have to assign him the same role(s) as the other user. Depending on complexity and the number of possible tabs/users combinations, you will or not have many roles with few rights, or a few roles with access to several tabs. The latter would probably be the case for a limited number of users, but the good thing is that you could easily scale up without changing the model, only the data.
I have 3 tables simplified to the below:
main_table
id | attribute1_id | attribute2_id | price
attribute1_table
id | attribute_name
attribute2_table
id | attribute_name
I've created a view in Sql Server that joins the tables together to give me the following output:
main_table
id | attribute1_id | attribute2_id | attribute1_name | attribute2_name | price
The problem I have is I want to be able to show the data in a DataGridView and allow the price to be editable. But I've created a "view" which I take it this is not the correct thing to use (i.e it's called a "view" which doesn't sound editable?)
I know I could create my own script to go through and update only the "main_table" but I think there must be a way to use DataGridView / Linked datasets with joined tables?
-
Best thing I can advise is to create a stored procedure that takes all of the parameters and then within that procedure do the individual update statements to the table. Should work fairly well.
I am wondering if it is possible to have a table in C# which allows one of the columns to appear as a row so each record is effectively two rows.
I am attempting to create a search engine for documents. I would like document properties such as document title, date created to be put into columns and also have an extract of the document in a column as well however I feel it would be more appropriate if the extract was on a new line similar to how google displays results with a page extract. I will be grateful for any advice on how this could be achieved. I am currently considering creating a jQuery component and loading it in this way unless there are any easier methods? Below is a depiction of how I imagine the table to look:
-----------------------------------------------
|Col 1 | col 2 | col3 |
-----------------------------------------------
|Data | data | data |
|Contents of col4 |
-----------------------------------------------
|Data | data | data |
|Contents of col4 |
-----------------------------------------------
Store the "extract" in it's own column in the database (each row is one "document"). Then, in your view, you can have it be displayed as it's own row in the HTML table. No need for jQuery.
I want to generate pdf file as attached in the picture. i want to harcode the contents shown in the picture into a pdf file on button click.
How do i proceed, using table structure will work?I am unable to form the table stucture here.
Please help me to sort out my problem.i want the output as shown in below image.
Here you have a good tutorial about using iTextSharp
http://www.mikesdotnetting.com/Category/20
First create one table with two columns like below
_______________________________________________
| | |
| | |
| | |
| COL.0.1 | COL.0.2 |
| | |
| | |
-----------------------------------------------
keep reference to its columns, then create table for left side content and insert it as child content of left column COL.0.1
------------------------------
| designation: xxxxxxx | <---- colspan = 2
------------------------------
| Audit No. | xxxx |
------------------------------
| Received on ....... |
-------------------------------
and you can continue for the rest of content similar to this.
The idea is to split content to smaller tables and nest them.