473,669 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Edit,AddNew and Delete Records in DataGrid

18 New Member
Hi All

I am new with Windows form. i am working on c#.net 2003. i have no idea how am i suppose to Edit, AddNew or Delete Record in DataGrid. I am passing a Dataset to my Grid. I want to modify,addnew and delete records in Grid. I know it must be very simple and easy, but i have no idea i have been searching and i am not able to find any proper solution. Any help would be really appreciated..Pl z help me out guys.

Madhu
Jun 4 '07 #1
2 2046
Frinavale
9,735 Recognized Expert Moderator Expert
Hi All

I am new with Windows form. i am working on c#.net 2003. i have no idea how am i suppose to Edit, AddNew or Delete Record in DataGrid. I am passing a Dataset to my Grid. I want to modify,addnew and delete records in Grid. I know it must be very simple and easy, but i have no idea i have been searching and i am not able to find any proper solution. Any help would be really appreciated..Pl z help me out guys.

Madhu
You will have to implement the function that handles the RowEditing event, and the function that handles the RowUpdating event.

You'll have to add a column that allows the user to start editing...

What have you tried so far?
Jun 4 '07 #2
mady1380
18 New Member
You will have to implement the function that handles the RowEditing event, and the function that handles the RowUpdating event.

You'll have to add a column that allows the user to start editing...

What have you tried so far?
Hi Frin

Thanks for your reply. Well in Web forms, generally you write the code behind the designer..that is in HTML, you give the name of the function for EditEvent and DeleteEvents, we can generally even add Link button in ItemTemplate and its much more flexible..Here firstly you cannot write behind the code that the HTML side. Then i see many codes online...which almost is like 6 to 7 methods and i dont know how much lines code they are. I am just surprised for just to make an Edit or Delete ..i have to write like 100 lines code? i see here they are using DataGridTableSt yle, DataGridcolumSt yles,DataTable, DataRow. I am just really surprised and trying to find out..isnt there any simple way with 10 - 20 lines of code that can provide me these functions? Please post the code if you have any for normal Edit and Addnew Functions. I know its very weird ,coz i am asking something in very much general here.. But i would really appreciate if you could post a normal Grid have DataSet and simply these function are performed.

Thanks for your respone.

Madhu
Jun 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3568
by: Aaron Ackerman | last post by:
I am using typed datasets in an N-Tier Windows app using VB.NET. I know this posting cannot be fully explained in a single post that is why I am asking for someone to point me to a real world tutorial (in vb.net) that can show me how to use a bound Datagrid to it's fullest potential. I need to utilize the bound Datagrid in two modes. One were a bound Datagrid can be in edited directly utilizing bound combos and textbox right on the grid,...
25
10394
by: dixie | last post by:
I have some code that adds new records into a table for each ID in a list box when a button on a form is clicked. This works fine. My problem now is that I wish to be able to edit all the records for people whose ID is in the list box. I made minor changes to the code (mainly replacing rs.AddNew with rs.Edit)and it appears to be updating only the first record and then overwriting that record with the next, etc until it runs out of ID's...
4
9691
by: drakuu | last post by:
Hello there, I have DataGrid with some records and I would like to edit it right in the datagrid using the built in commands. I can't figure out a way to pass to the SQL query the record ID which I'm editing. SELECT: SelectCommand="SELECT ProviderID, AddressID, Address, Address2, City, State, County, Zip FROM ProviderAddress WHERE (ProviderID = @ProviderID)"
9
2714
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the code: <script runat="server"> Dim sqlConn As New SqlConnection(".....") Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) If Not (Page.IsPostBack) Then FillDataGrid()
9
7743
bhcob1
by: bhcob1 | last post by:
Hey guys, 'Update or CancelUpdate without AddNew or Edit' On my database i keep occasionly get this error when i try and edit a field, it is not everytime. It will be working fine and then this error appears. I will be editing records and then a random one will get the error. A bit of background on my form, this will seem a bit lengthy but here is my code. The form has a navigation list which the user can select a record to view. An...
1
2456
by: teenagelcruise | last post by:
hi, i have a problem with my code which is i cannot update and addnew data into the database but i can delete the data.plz give me an idea.this is my code that i wrote. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Order Record</title> <meta name="Microsoft Border" content="tlb, default"> </head>
0
8462
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8382
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
8802
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...
1
8586
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6209
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
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1787
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.