Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2007, 01:29 AM
Authorized User
 
Join Date: Aug 2006
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to delete from datagrid

hi friends,
          i would like to get help from u to delete a particular row from a datagrid,using a radio button confirmation.please help me for the same.i am working with c#.net and sqlserver.
                                         thanks,
                                                sumith.
__________________
sumith
 
Old February 23rd, 2007, 09:17 AM
Authorized User
 
Join Date: Aug 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

use datagrids deletecommand event

in which u will get the selected record
using e



 
Old February 23rd, 2007, 05:12 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

You can add a template column to the datagrid:

<asp:TemplateColumn ItemStyle-HorizontalAlign="Center" HeaderText="Delete">
<ItemTemplate>
<asp:ImageButton CommandName="Delete" ID="btnDelete" ImageUrl="/images/delete_cir.gif" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

Then create a Sub to do the delete:

    Sub doDelete(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles grdLeakRates.ItemCommand
        Try
            If e.CommandName = "Delete" Then
                _oConn.Open()
                Dim SQL As String = "DELETE FROM [tablename] Where [ID Column] = " & [gridname].DataKeys(e.Item.ItemIndex) & ";"
                Dim CMD As New SqlCommand(SQL, _oConn)
                CMD.ExecuteNonQuery()
            End If
        Catch ex As Exception
            Session("Alert") = ex.Message
        Finally
            getLeakRates()
            _oConn.Close()
        End Try
    End Sub

 
Old March 6th, 2007, 01:04 AM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi friends in asp.net ,I want to know if we can refresh each user control on a page.
The page contains a lot of user controls






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help: Right-click to delete in a datagrid nabrusim VB.NET 2002/2003 Basics 1 November 4th, 2007 12:10 PM
How can i Insert , delete data from datagrid ?? jay4ever_2000 ASP.NET 1.0 and 1.1 Professional 1 February 17th, 2006 03:35 PM
checkbox in datagrid and delete saman VS.NET 2002/2003 2 May 21st, 2004 12:00 AM
Trapping Delete in the Datagrid jraymond VB.NET 2002/2003 Basics 5 July 10th, 2003 04:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.