Professional Web Applications Themes

Problem Hiding Columns when Populating a Datagrid with a DataView of A DataTable From Dataset returned via an Asynchronous Web-Service - ASP.NET Data Grid Control

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 ...

  1. #1

    Default 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
    [email]bob.daviesdcml.co.uk[/email]


    Bob Davies Guest

  2. #2

    Default 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
    [email]bob.daviesdcml.co.uk[/email]


    Bob Davies Guest

  3. #3

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

    Bob,

    You wan't find much help here since your problem has nothing to do with
    ASP.NET datagrid which is what this newsgroup for. Ask on more appropriate
    forums.

    Eliyahu

    "Bob Davies" <bob.daviesdcml.co.uk> wrote in message
    news:xl4nd.120$4B3.76newsfe2-win.ntli.net...
    > 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
    > [email]bob.daviesdcml.co.uk[/email]
    >
    >

    Eliyahu Goldin Guest

  4. #4

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

    Hi Bob,

    I don't know if I can help, but perhaps I can shed some light. I'd expect
    that the dataset itself is not the return type you want to pass back. Not
    only are datasets pretty clumsy to deal with in a non-windows client, but
    there are many issues such as the ones you are experiencing. As I
    undertand it, the dataset as returned is going to be read-only, so adding
    anything to it is going to be blocked. Have you tried creating a new
    dataset on the caller side post-call return, copying the data into that
    new, disconnected dataset, making sure that it is a writable dataset, and
    then doing your tableset manipulations on the new dataset?

    It isn't clear to me what you mean by asynchronous - since one way calls
    don't return data. I'm going to asume you are calling a normal web service
    in a non-blocking fashion (via beginXXmethod).

    There are some good examples and articles that I uncovered by google search
    for "web service returns dataset"

    Here are some that may help you understand the issues you are going to face.
    [url]http://support.microsoft.com/default.aspx?scid=kb;en-us;306134[/url]
    [url]http://samples.gotdotnet.com/quickstart/aspplus/doc/servicesanddata.aspx[/url]
    [url]http://www.c-sharpcorner.com/Code/2002/April/UsingDataSetInWebServicesFB.asp[/url]

    Hope this helps

    Dan Rogers
    Microsoft Corporation
    --------------------
    >From: "Bob Davies" <bob.daviesdcml.co.uk>
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservic es
    >Subject: Problem Hiding Columns when Populating a Datagrid with a DataView
    of A DataTable From Dataset returned via an Asynchronous Web-Service
    >Lines: 53
    >X-Priority: 3
    >X-MSMail-Priority: Normal
    >X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
    >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
    >X-RFC2646: Format=Flowed; Original
    >Message-ID: <wl4nd.119$4B3.4newsfe2-win.ntli.net>
    >Date: Thu, 18 Nov 2004 16:46:20 GMT
    >NNTP-Posting-Host: 62.255.248.75
    >X-Complaints-To: [url]http://www.ntlworld.com/netreport[/url]
    >X-Trace: newsfe2-win.ntli.net 1100796380 62.255.248.75 (Thu, 18 Nov 2004
    16:46:20 GMT)
    >NNTP-Posting-Date: Thu, 18 Nov 2004 16:46:20 GMT
    >Organization: ntl Business News Service
    >Path:
    cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT FEED02.phx.gbl!tornado.fas
    twebnet.it!tiscali!newsfeed1.ip.tiscali.net!border 2.nntp.ams.giganews.com!nn
    tp.giganews.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!newspeer1-w
    in.ntli.net!newsfe2-win.ntli.net.POSTED!53ab2750!not-for-mail
    >Xref: cpmsftngxa10.phx.gbl
    microsoft.public.dotnet.framework.aspnet.webservic es:26689
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
    >
    >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
    >bob.daviesdcml.co.uk
    >
    >
    >
    Dan Rogers Guest

Similar Threads

  1. Can't Bind Datagrid with Dataset returned by WebService
    By QuocSI in forum ASP.NET Web Services
    Replies: 1
    Last Post: August 12th, 11:09 AM
  2. Binding Two DataTable Columns to One DataGrid Column
    By quiggle in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: April 2nd, 04:12 PM
  3. Recreate dataview/datatable/dataset from Datagrid
    By Zachary Heilman in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: October 23rd, 02:33 PM
  4. Hiding and Showing Columns in the DataGrid Control...
    By Amber in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: October 11th, 07:17 PM
  5. how to use XSL to format dataset returned from a web service?
    By Jason Shohet in forum ASP.NET General
    Replies: 0
    Last Post: August 1st, 02:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139