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

DataGridView issue

Hi there.

I have a DataGridView on a desktop application and it's being filled through
the use of a Web Service, wich returns a DataSet. The I use
datagrid.DataSource=mydataset.tables[0] to bind the data.
This dataset contains a table with 4 columns: id, description, status,
private. Column status can take 4 values, and private, 2 values.

My question is: how can I make the column status a
DataGridViewComboBoxColumn and column private a DataGridViewCheckBoxColumn?

I know that, at design time, I can add ComboBox and CheckBox columns, but
how can I mapp those columns with the data returned by the DataSet, trough
the web Service?

Thanks in advance.

Regards.

Marco
Dec 20 '07 #1
3 1688
Marco,

Can you create a typed instance of the data set in your code which is
the same as what the server returns (when you created the reference for your
proxy, it should have created some sort of type which exposes these
properties properly).

Using that, you should be able to bind to ^that^ and then configure your
grid properly.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Marco Pais" <marco.pais[at]gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi there.

I have a DataGridView on a desktop application and it's being filled
through the use of a Web Service, wich returns a DataSet. The I use
datagrid.DataSource=mydataset.tables[0] to bind the data.
This dataset contains a table with 4 columns: id, description, status,
private. Column status can take 4 values, and private, 2 values.

My question is: how can I make the column status a
DataGridViewComboBoxColumn and column private a
DataGridViewCheckBoxColumn?

I know that, at design time, I can add ComboBox and CheckBox columns, but
how can I mapp those columns with the data returned by the DataSet, trough
the web Service?

Thanks in advance.

Regards.

Marco

Dec 20 '07 #2
Hi there.

I worked around using something like this:

ds = srv.GetData(); // the Web Method of my Web Service

dgv.AutoGenerateColumns = false;
dgv.DataSource = ds.Tables[0];

DataGridViewTextBoxColumn TextBoxColumn1 = new
DataGridViewTextBoxColumn();
TextBoxColumn1.HeaderText = "Id";
TextBoxColumn1.Width = 60;
TextBoxColumn1.DataPropertyName = "id";

DataGridViewCheckBoxColumn CheckBoxColumn = new
DataGridViewCheckBoxColumn();
CheckBoxColumn.HeaderText = "Descrição";
CheckBoxColumn.DataPropertyName = "estado";

dgv.Columns.Add(TextBoxColumn1);
dgv.Columns.Add(CheckBoxColumn);

It works!

Now, I'm having another problem. How can I uptade data via WS again?

If I used DataAdapter/DataSet, I would be easier. But, in this case, I will
use a Web Service to update data on database - something like, when I click
an update button, it will execute:

srv.UpdateData(data); // srv - my Web Service

How can I get the data that I edited in DataGridView and update database via
WS?

Thanks again.

Ragards.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comescreveu
na mensagem news:Oa**************@TK2MSFTNGP04.phx.gbl...
Marco,

Can you create a typed instance of the data set in your code which is
the same as what the server returns (when you created the reference for
your proxy, it should have created some sort of type which exposes these
properties properly).

Using that, you should be able to bind to ^that^ and then configure
your grid properly.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Marco Pais" <marco.pais[at]gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Hi there.

I have a DataGridView on a desktop application and it's being filled
through the use of a Web Service, wich returns a DataSet. The I use
datagrid.DataSource=mydataset.tables[0] to bind the data.
This dataset contains a table with 4 columns: id, description, status,
private. Column status can take 4 values, and private, 2 values.

My question is: how can I make the column status a
DataGridViewComboBoxColumn and column private a
DataGridViewCheckBoxColumn?

I know that, at design time, I can add ComboBox and CheckBox columns, but
how can I mapp those columns with the data returned by the DataSet,
trough the web Service?

Thanks in advance.

Regards.

Marco


Dec 20 '07 #3
Marco,

Well, since you attach the table as the DataSource for the grid, you can
get the DataTable back from the DataSource and then access the DataSet
through the DataSet property on the DataTable. Then you can pass that back
to the service.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Marco Pais" <marco.pais[at]gmail.comwrote in message
news:OI**************@TK2MSFTNGP03.phx.gbl...
Hi there.

I worked around using something like this:

ds = srv.GetData(); // the Web Method of my Web Service

dgv.AutoGenerateColumns = false;
dgv.DataSource = ds.Tables[0];

DataGridViewTextBoxColumn TextBoxColumn1 = new
DataGridViewTextBoxColumn();
TextBoxColumn1.HeaderText = "Id";
TextBoxColumn1.Width = 60;
TextBoxColumn1.DataPropertyName = "id";

DataGridViewCheckBoxColumn CheckBoxColumn = new
DataGridViewCheckBoxColumn();
CheckBoxColumn.HeaderText = "Descrição";
CheckBoxColumn.DataPropertyName = "estado";

dgv.Columns.Add(TextBoxColumn1);
dgv.Columns.Add(CheckBoxColumn);

It works!

Now, I'm having another problem. How can I uptade data via WS again?

If I used DataAdapter/DataSet, I would be easier. But, in this case, I
will use a Web Service to update data on database - something like, when I
click an update button, it will execute:

srv.UpdateData(data); // srv - my Web Service

How can I get the data that I edited in DataGridView and update database
via WS?

Thanks again.

Ragards.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>
escreveu na mensagem news:Oa**************@TK2MSFTNGP04.phx.gbl...
>Marco,

Can you create a typed instance of the data set in your code which is
the same as what the server returns (when you created the reference for
your proxy, it should have created some sort of type which exposes these
properties properly).

Using that, you should be able to bind to ^that^ and then configure
your grid properly.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Marco Pais" <marco.pais[at]gmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>Hi there.

I have a DataGridView on a desktop application and it's being filled
through the use of a Web Service, wich returns a DataSet. The I use
datagrid.DataSource=mydataset.tables[0] to bind the data.
This dataset contains a table with 4 columns: id, description, status,
private. Column status can take 4 values, and private, 2 values.

My question is: how can I make the column status a
DataGridViewComboBoxColumn and column private a
DataGridViewCheckBoxColumn?

I know that, at design time, I can add ComboBox and CheckBox columns,
but how can I mapp those columns with the data returned by the DataSet,
trough the web Service?

Thanks in advance.

Regards.

Marco



Dec 20 '07 #4

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

Similar topics

10
by: milk-jam | last post by:
I'm trying to set my datagridview so that the first row will be left blank and to use it as a filtering filed for the datagridview. Until now I was using 2 datagridview the upper one with a header...
1
by: cc | last post by:
Hi, using the DataGridView (.NET 2005) : I have a row currently selected in the Grid (say the 3rd row showing 'Product3') Now, when I click on a column to sort the records is the 'Product3'...
3
by: WayDownUnder | last post by:
I have a datagridview that is bound to a cutom collection. The classes contained in the custom collection have the properties that are bound to the class . This works fine ! But if one of the...
7
by: steve | last post by:
Hi All I urgently need help on setting datagridview cell borders at runtime I found some code on the web from Programming Smart Client Data Applications with .NET 2.0 by Brian Noyes See...
2
by: Rick Shaw | last post by:
Hi, I have a problem with the datagridview not refreshed when the application first appear on the screen. The datagridview display data from a table in the dataset. At the same time, I've added...
1
by: Karl | last post by:
Hi all... This is a good one. You'll like this... I am working on a course management tool that allows certain Courses to be cross referenced with Job Roles and, when they are, whether the...
0
by: Andrus | last post by:
I tried to use modeless picklist for DataGridView custom ComboBoxColumn without success. Steps to reproduce issue: 1. Run code 2. Enter some character 3. Press Tab Observed:
6
by: hzgt9b | last post by:
Using VS2005, VB.NET, I have a windows app with a DataGridView (lets call it DGV). At some point in the life of my app I want to clear the selection of the currently selected row...
18
by: Andrus | last post by:
Marc, Thank you very much. I have issue on implementing add row properly using this. User presses down arrow in last row in grid starting adding new row. Then user changes its mind desiding...
6
by: Miro | last post by:
Sorry for the cross post. I am stuck. I have a datagridview for poker rounds. Basically there are 3 columns in this datagridview. "Round" "SmallBlind" "BigBlind" I have an issue when I tab...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.