By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,377 Members | 3,052 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,377 IT Pros & Developers. It's quick & easy.

Datagrid Bind Value update on the fly

P: n/a
Hi

I have a Winforms Datagrid and created myDataView and bind to datagrid.
It works great.

DataGrid1.SetDataBinding(myDataView, "")

Above code line shows me below data in datagrid.

CustomerID CustomerName City
------------------------------------
001 AAA Company NY
002 DDD Company FL
003 CCC Company NY
004 PPP Company FL
------------------------------------

There is a requirement when showing the grid data, I need to show as
below.

CustomerID CustomerName City
------------------------------------
001 AAA Company New York
002 DDD Company Florida
003 CCC Company New York
004 PPP Company Florida
------------------------------------

What I mean is i have to show 'City' datagrid column with 'NY'=New York
and 'FL'=Florida in datagrid

Waiting for your reply.

Thanks in advance

Jul 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi
I have a Winforms Datagrid and created myDataView and bind to datagrid.

It works great.
DataGrid1.SetDataBinding(myDat*aView, "")
Above code line shows me below data in datagrid.
CustomerID CustomerName City
------------------------------*------
001 AAA Company NY
002 DDD Company FL
003 CCC Company NY
004 PPP Company FL
------------------------------*------
There is a requirement when showing the grid data, I need to show as
below.
CustomerID CustomerName City
------------------------------*------
001 AAA Company New York
002 DDD Company Florida
003 CCC Company New York
004 PPP Company Florida
------------------------------*------
What I mean is i have to show 'City' datagrid column with 'NY'=New York

and 'FL'=Florida in datagrid
Waiting for your reply.
Thanks in advance

ka***@hotmail.com

Jul 21 '05 #2

P: n/a
I would begin by reading up on validation tables used to enforce
business
rules. Create a table States with a primary key State and a column State
Name.
Enforce a one to many relationship so that Customer table State column
is a
foreign key to the primary key State in the States table. Once you
establish
the proper database design you can generate an SQL query that appears as
you request without fear that a State in the Customer table does not
have a
valid State Name in the States table.

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Jul 21 '05 #3

P: n/a
Hi Jeff

Thanks for your reply. Appreciate it.

I think I have not mention my problem properly. Let me expalin again.

What i have to do is i generate the dataset via sql then bind it to
datagrid so it shows in datagrid.

My problem is when I bind it, It shows 'NY' 'FL' etc. in 'City
Column'

Actually I want a way to update/change text in the datagrid's CITY
column (only) with text 'New York' 'Florida' etc.... and I do not have
a table in my database to actually join two tables.... and also need
to give user an option so that thay can specify 'From Text' (NY) to 'To
Text" (New York) etc. so that they can manage themselves.

Hope this may help you to understand.

Please reply in this post for any query.

Regards

Kakaiya

Jul 21 '05 #4

P: n/a
kakaiya... I just finished working a 12 hour shift and cannot respond
with
much intelligence. I think that you are trying to implement a "lookup"
There
are plenty of examples for a States lookup using a combo box. I just
don't
have the energy to try this for a dataset, but it seems to me you can
manipulate the values in the dataset programmatically and then bind the
dataset to a datagrid.

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.