473,808 Members | 2,852 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid Bind Value update on the fly

Hi

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

DataGrid1.SetDa taBinding(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

Jul 21 '05 #1
4 1319
Hi
I have a Winforms Datagrid and created myDataView and bind to datagrid.

It works great.
DataGrid1.SetDa taBinding(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.c om

Jul 21 '05 #2
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
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
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 programmaticall y and then bind the
dataset to a datagrid.

Regards,
Jeff

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

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

Similar topics

2
5678
by: Manish | last post by:
Hey folks I am having a weird problem in ASP .Net. My page is in C#. I have a datagrid, which populates based on selection in drop down box on ASP page. This datagrid has template textbox colum in itemtemplate. Datagrid is something like this- Category Week Amt Week% Button Revenue 1 100 Update Revenue 2 200 Update Cost 1 25 25
3
4889
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
0
2408
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a CheckBox Programmatically" in my code. I have changed it to use a OLDDB.DBReader to populate the datagrid and for the databinding. It works perfectly - also when using the edit-mode in the datagrid.
0
473
by: Steve | last post by:
I have a datagrid that is created at run time DataGrid dgG = new DataGrid(); BoundColumn bcB; dgG.CellPadding = 5; dgG.CellSpacing = 0; dgG.GridLines = GridLines.Both; dgG.CssClass = "SectionTableLines"; dgG.DataKeyField = "PlanWorkOrderID";
3
2222
by: D. Shane Fowlkes | last post by:
I have a Datagrid which in theory, should allow you to edit and update the records. I've stripped my test page down so that it's only attempting to update one field - "description". Yet when I make the changes and click Update, it reverts back to the old value. I'm stumped! I've also checked the db table and it is infact not updating. I'm attempting to follow and example right out of ASP.NET Unleashed but not having much luck. Any...
5
1875
by: Hennie | last post by:
When trying to update a record in an editable datagrid I ran into a few problems. My update procedure is just not working. Can someone please have a look at my code and see what am I doing wrong. I had to set the datagrid's DataKeyField to MailSubscriberID manually since vs does not do it automatically. Thanks
3
278
by: Ryan Smith | last post by:
I have a Datagrid that I can't seem to get to work. I can populate the grid from a database but I can't figure out how to update the DB when the user edits a templated column. I have done it before and copied the code over but it isn't working. Any help is greatly appreciated. Code behind: Sub DoItemUpdate(ByVal objSource As Object, ByVal objArgs As DataGridCommandEventArgs)
17
2773
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 allow user to filter the first time, when they tried the second time, the speficied cast error message will prompt one.... I create a mydataset1 first, and the mydataset1 data source was getting from DataGrid.DataSource.
0
1538
by: arlie_maija | last post by:
Hey - I'm writing a control that contains a DataGrid, and I'm unable to get the update event to fire. When I click the update link, the edit event fires. heres the details... my control overrides CreateChildControls and dynamically creates the DataGrid, creates an EditCommandColumn which it adds to the
13
2463
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever works best) to display a dropdown menu of fields populated from table tblInvoiceData. This control also includes a textbox which the user can input a value. These two columns are side by side and not in a vertical layout. The user then clicks on...
0
9600
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10373
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10113
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9195
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.