472,799 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,799 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


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

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

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

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

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.
Nov 21 '05 #1
0 2498

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

Similar topics

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"...
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...
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...
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....
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,...
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...
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 =...
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 =...
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...
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...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.