This is a migrated thread and some comments may be shown as answers.

Very strange offset problem when programmatically adding textboxes

3 Answers 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dave Harris
Top achievements
Rank 1
Dave Harris asked on 20 Dec 2007, 12:04 AM
I've been working on a report that requires me to manually add a grid of textboxes. I'm using a very standard method to do so (loop through an array and keep track of the current Y position etc. etc.).

However, for some insanely odd reason (I can't even wrap my mind around this), the third column item is pushed down further than all other items during the first iteration through my collection. Furthermore, this will only happen when I put textboxes above the area I build my grid in.

It's very cryptic to explain, so I've made a project that duplicates the behavior. I'm sure this is hard to understand, so I'll just post my project and wait for the questions.

Sample Project

3 Answers, 1 is accepted

Sort by
0
Milen | Product Manager @DX
Telerik team
answered on 20 Dec 2007, 04:39 PM
Hello Dave Harris,

Thank you for your question.

To avoid this behavior, set not only the Width of the generated TextBox item, but the Height of the item as well. Indeed, the items should look the same even if you do not set the Height, so we will investigate further this case.

Please review the attached modified version of your example with the applied fix.

Notice that to display objects like the TestCollection on a Telerik report you do not have to generate items dynamically. You can set it as DataSource of the report. See the added report called ObjectDataSource in the sample.

Best wishes,
Milen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Dave Harris
Top achievements
Rank 1
answered on 20 Dec 2007, 07:24 PM
I do understand that I can set the collection as the datasource for the report. But what I am actually attempting to do is display a collection contained by the parent object.

For example, let's say I have a class called Order and it has a property called OrderItems which maps to a collection of items for the Order. I haven't been able to find a way to display the OrderItems by using a subreport or any method other than dynamically painting the items onto the report. The reporting seems like it works best when it has direct access to the database or dataset. Unfortunately I'm getting my data from a webservice that returns complex types, not datasets.

Attached is the same sort of project with an example of what I'm trying to do. If there is a better way of doing this, please let me know.

Sample Project
0
Dave Harris
Top achievements
Rank 1
answered on 20 Dec 2007, 09:12 PM
Yikes! Nevermind. Temporary onset of stupidity. Don't bother answering the question above.
Tags
General Discussions
Asked by
Dave Harris
Top achievements
Rank 1
Answers by
Milen | Product Manager @DX
Telerik team
Dave Harris
Top achievements
Rank 1
Share this question
or