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

To delete a record from datagrid...

111 100+
hii all,

i have a datagrid....with no. of rows...

i want to delete a particular row from the datagrid....(database too)

plz help me...

thnx...
Aug 8 '07 #1
4 1284
Frinavale
9,735 Expert Mod 8TB
hii all,

i have a datagrid....with no. of rows...

i want to delete a particular row from the datagrid....(database too)

plz help me...

thnx...
Have you seen MSDN's article on Allowing users to delete items in a DataGrid?

:)

-Frinny
Aug 8 '07 #2
Have you seen MSDN's article on Allowing users to delete items in a DataGrid?

:)

-Frinny
Hi,

Try this

private void DataGrid1_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int rowToDelete = e.Item.ItemIndex;
// Add code to delete row from data source.
DataGrid1.DataBind();
}

Hope that makes sense.

Thanks
Vivek
Aug 8 '07 #3
Hi,

Try this

private void DataGrid1_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int rowToDelete = e.Item.ItemIndex;
// Add code to delete row from data source.
DataGrid1.DataBind();
}

Hope that makes sense.

Thanks
Vivek
hi dear try this this willl work definatly
both tempary and parmanetly
Protected Sub dgBankDetails_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles dgBankDetails.RowDeleting
Try
dtBankDetail = Session("dtBankDetail")
Dim intcount As Integer = dtBankDetail.Rows.Count
Dim ArrVLEAccountDtlId(intcount) As String
If dgBankDetails.Rows.Count > 0 Then
''Dim ArrDtlBankId As New ArrayList(1)
''Dim ArrDtlLoanId As New ArrayList(1)
''Dim ArrDtlLandId As New ArrayList(1)
'manish
If dtBankDetail.Rows(e.RowIndex).Item("VLEAccountDtlI d") <> "" Then
Session("ArrDtlBankId").Insert(Session("ArrDtlBank Id").Count, dtBankDetail.Rows(e.RowIndex).Item("VLEAccountDtlI d"))
End If
ArrVLEAccountDtlId(0) = dtBankDetail.Rows(e.RowIndex).Item("VLEAccountDtlI d")
dtBankDetail.Rows(e.RowIndex).Delete()
dtBankDetail.AcceptChanges()
dgBankDetails.DataSource = dtBankDetail
dgBankDetails.DataBind()
End If
Aug 9 '07 #4
rhepsi
111 100+
hi dear try this this willl work definatly
both tempary and parmanetly
Protected Sub dgBankDetails_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles dgBankDetails.RowDeleting
Try
dtBankDetail = Session("dtBankDetail")
Dim intcount As Integer = dtBankDetail.Rows.Count
Dim ArrVLEAccountDtlId(intcount) As String
If dgBankDetails.Rows.Count > 0 Then
''Dim ArrDtlBankId As New ArrayList(1)
''Dim ArrDtlLoanId As New ArrayList(1)
''Dim ArrDtlLandId As New ArrayList(1)
'manish
If dtBankDetail.Rows(e.RowIndex).Item("VLEAccountDtlI d") <> "" Then
Session("ArrDtlBankId").Insert(Session("ArrDtlBank Id").Count, dtBankDetail.Rows(e.RowIndex).Item("VLEAccountDtlI d"))
End If
ArrVLEAccountDtlId(0) = dtBankDetail.Rows(e.RowIndex).Item("VLEAccountDtlI d")
dtBankDetail.Rows(e.RowIndex).Delete()
dtBankDetail.AcceptChanges()
dgBankDetails.DataSource = dtBankDetail
dgBankDetails.DataBind()
End If

thnx so much....

but mine is windows application (vb.net 1.1)

then wat namespace shd i use ???

thnx..
hepsi..
Aug 9 '07 #5

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

Similar topics

0
by: Symphony | last post by:
Hi,all: our web application using vb.net and xp. we have a web form using a datagrid, when load that page, it will list all our cutomer info. to the datagrid. The first column of the datagrid is...
4
by: Calvin Lai | last post by:
Hi all, Does anyone know how I could add a confirm (client side) feature on those Delete Linkbutton in DataGrid? Thanks,
6
by: JenHu | last post by:
Hi experts, I want to add a delete button in my datagrid, and before it deletes from database, I want to have a confirm dialog box for this deletion. I am entry level to the vb.net, and don't...
4
by: DrData | last post by:
I'm working on an ASP.Net application written in C#. On one page, there are several datagrid controls used to display, edit and delete detail records relating to the master record also displayed on...
0
by: laurent | last post by:
Environment: VS NET 2003 Fr Framework: 1.1 OS: WinXP SP2 Fr Hello I have a problem to add with pop-up and to delete in a datagrid(ButtonColumn delete) on WebForms. code button HTML which...
4
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...
2
by: tomcarr1 | last post by:
In this walkthrough on "Allowing Users to Delete Items in a DataGrid Web Server Control" at: ...
5
by: rn5a | last post by:
The .NET 2.0 documentation states the following: When using a DataSet or DataTable in conjunction with a DataAdapter & a relational data source, use the Delete method of the DataRow to remove...
10
by: amiga500 | last post by:
Hello, I have one basic simple question. When I have multiple records in the datagrid as follows: Code Product 1 Product 2 Product 3 11111 A B C...
2
by: Iain | last post by:
Hi All I am witing a web app using Delphi developer 2006 (C# app) and I have a datagrid. Excuse the numptyness of the question. I have a datagrid with the ability to Insert, Edit/Update and...
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: 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
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...
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...
0
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...
0
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,...

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.