Datagrid Bind Value update on the fly

  • Thread starter Thread starter kakss
  • Start date Start date
K

kakss

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

(e-mail address removed)
 
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
 
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
 
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
 
Back
Top