473,395 Members | 1,556 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,395 software developers and data experts.

How to manage a datagrid with 2 dataview as possible datasource?

Hi, I'm using vs2005, .net 2 for windows applciation. I have a form with 1
datagrids whose datasource comes from 2 dataview that are based on 2 dataset
datatables(depends on the stat of the application then one of the dataview
will be selected as datasource for the grid). Both dataview have only 2
columns but one of the columns name is different. Depending on the state of
the application, I would need to change the datasource to be attached to the
datagrid. This is where the problem occurs. The grid has a column created
in the designer that is looking for certain column name in the other dataview
as a datasource. Do I remove and save the column in the grid, add the new
columns name column and reverse it when the application changes? Or, would
it be better if I just create and layer another gird and hide one of the grid
according to the application state? Which would be a better performance
solution? I expect the grid to contain the most is a couple of thousands of
rows.
--
Thanks.
Jun 16 '07 #1
7 1732
columns but one of the columns name is different. Depending on the state
of
the application, I would need to change the datasource to be attached to
the
datagrid. This is where the problem occurs. The grid has a column
created
Keep the data-views in Session, if they're user dependent.
Or else, keep them in Cache. Pick the one needed.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Jun 16 '07 #2
columns but one of the columns name is different. Depending on the state
of
the application, I would need to change the datasource to be attached to
the
datagrid. This is where the problem occurs. The grid has a column
created
Keep both of them in memory.
When needed, use DataGrid.SetDataBinding(<data-view>, "") to switch from one
view to another.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------

Jun 16 '07 #3
Keep the data-views in Session, if they're user dependent.
Or else, keep them in Cache. Pick the one needed.
Ignore this posting.
I didn't read that it was a Win-form application. See the other response
that I have already posted.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Jun 16 '07 #4
Ignore which posting? You think it's better if I don't create an additional
grid to hold the 2nd dataview? I tried switching by setting datasource but
the grid complaint about not able to find the column from the other dataview.
How shoud I address this?
--
Thanks.
"MasterGaurav (www.edujini-labs.com)" wrote:
Keep the data-views in Session, if they're user dependent.
Or else, keep them in Cache. Pick the one needed.

Ignore this posting.
I didn't read that it was a Win-form application. See the other response
that I have already posted.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Jun 16 '07 #5
Ignore which posting? You think it's better if I don't create an
additional
Ignore the one using "Session/Cache" :-)
grid to hold the 2nd dataview? I tried switching by setting datasource
but
the grid complaint about not able to find the column from the other
dataview.
How shoud I address this?
How are you setting the data source?
You should use the method SetDataBinding in .Net 2.0
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Jun 17 '07 #6
I'm using datagridview and there is no SetDatabinding available. I can
either set datasource or set databinding. Thanks.
--
Thanks.
"MasterGaurav (www.edujini-labs.com)" wrote:
columns but one of the columns name is different. Depending on the state
of
the application, I would need to change the datasource to be attached to
the
datagrid. This is where the problem occurs. The grid has a column
created

Keep both of them in memory.
When needed, use DataGrid.SetDataBinding(<data-view>, "") to switch from one
view to another.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------

Jun 21 '07 #7
I'm using datagridview and there is no SetDatabinding available. I can
either set datasource or set databinding. Thanks.
Ah! Your earlier posting(s) and even the subject reads "DataGrid". Fix that
:-)

There are two things while setting the DataSource.

1. As soon as the DataSource is set, OnDataSourceChanged method is called
which, apart from other things, refreshes the grid and raises the
DataSourceChanged event
2. If the DataSource instance set is same as the previously set instance,
irrespective of whether the content in the source has changed or not, the
refresh will not happen. If saves precious time and CPU-cycles.

To get across the problem arising out of second scenario, first set the
value of DataSource to null and then to the same input once again.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Jun 24 '07 #8

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

Similar topics

2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
2
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit...
7
by: DC Gringo | last post by:
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub DataGrid1_SortCommand: -------------------- Private...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
4
by: Suzanne | last post by:
Hi all, I'm having problems with datagrids and the currentcellchanged event. My problem is this: I have a datagrid on a form, if the user changes the text in a cell on the datagrid then tries to...
1
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .....
9
by: John Hernry | last post by:
I have been watching the dotnet newsgroups for a couple of weeks now and scouring the net looking for a solution to my datagrid find functionality. With no luck. I am hoping that you can help me....
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
3
by: astro | last post by:
I have a datagrid that is two levels down from the dataview (i.e. grandchild). I have spent 3 hours trying to get the syntax of determining it's real datasource (i.e. not it's source based on it's...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.