473,416 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Problem Hiding Columns when Populating a Datagrid with a DataView of A DataTable From Dataset returned via an Asynchronous Web-Service

Hi

I have a webservice that retrieves data from a database, this is then
returned to the calling client application built in windows forms within a
dataset, however upon attempting to create tablestyles to format any of the
columns within the datagrid, the exception "Can-not parent objects created
on one thread to objects created on another" or words to that effect.

I'm not too sure if what I said make sense, but i will add details to
clarify.

I have an MDI Windows Forms interface, which contains a Method called
CommunicateWithDatabase(args) this then sends the datarequest to the
webservice (tryed both synchronous, asynchronous methods, including creating
the calling method on a different thread and not on a different thread to
the UI thread). Any sub-forms mdiparent'ed to the main form request data via
MainForm.CommunicateWithDatabase(args).

The data returned from the web-service is held within a DataSet, and all the
data is present in memory using any retrieval/access method.
DataSet.Tables[0] is passed into the subform as a DataTable which is then,
within a control containing a standard DataGrid and DataView is set as the
source of the DataView (Datagrid.Datasource = Dataview; DataView.DataSource
= DataSet.Tables[0])

Once the datasource of the dataview is set, and thus the datagrid. I proceed
to hide columns within the datagrid using the addition of tablestyles with
columnwidth set to 0 or otherwise for non-hidden. This is where the problem
occurs.

Essentially the problem is currently seen to be that the new tablestyles
can't be created on the datagrid as the underlying dataset was created on
the web-service thread and the new tablestyles has been created on the
windows forms UI thread. I have also tried to pass a dataset into the
webservice and retrieve the same one, but i assumed this wouold not work and
I was seemingly correct about this. As well as having tried a .copy of the
dataset into a locally created new dataset.

It is essential that i use this method of accessing the database via a
web-service for security reasons. However the rest of the interface is still
changeable.

Does anyone know of any way to allow tablestyles to be created on a datagrid
referencing a dataset/datatable created on a different thread? or a
different workaround for this problem. Please feel free to email me
regarding this issue or any associated topic that may be of use, this is now
becoming a huge problem for this particular development cycle :(

Thanks Very much for any help.
Bob
bo********@dcml.co.uk
Nov 21 '05 #1
0 2555

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Reb | last post by:
I am using a datagrid within another datagrid. My second datagrid is expand/collapse one. I am facing some error. This is my code. ExpandGrid.aspx <form id="Form1" method="post"...
3
by: michael haller | last post by:
In my project i have a textfile witch i import in my c# application. The datas in the textfile i show the datas in the textfile in my datagrid..ok that ist not my problem. Now i have a...
8
by: Inigo Jimenez | last post by:
I have an ASP .net web application installed in a Windows 2003 server. This web application has a webform that has a Datagrid. This Datagrid is filled with the data of a SQL table. I have a...
2
by: ddaniel | last post by:
I have read many posts and seen many papers on the different techniques for sort and filtering datagrids. Many do re-queries against the dB ala Fritz Onion. I am trying to leverage the Dataview....
7
by: Girish | last post by:
OK.. phew. Playing with data grids for the past few days has been fun and a huge learning experience.. My problem. I have a requirement to display a gird with a gird. Within the embedded grid,...
0
by: Tim::.. | last post by:
Hi... I'm having a big problem with a datagrid that obtains data from 2 different locations... Active Directory and SQL Database The data is inserted into a datatable and the sorted by a...
8
by: Dave Hagerich | last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being displayed, using the following code as a test: DataView theView = new DataView(theDataSet.Tables); theView.RowFilter =...
1
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
6
by: Ron L | last post by:
I have a dataset whose source is a SQL 2k stored procedure that I am trying to display in a datagrid. This datasource has 4 columns that I am interested in here, a text column and 3 value columns...
0
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.