Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 September 22nd, 2006, 02:26 AM
Authorized User
 
Join Date: Jun 2006
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid Problem

HI EVERY1

I AM USING DATAGRID CONTROL IN MY APPLICATION.FIRST COLUMN CONTAINS RADIO BUTTONS.WHEN I CHECKED ON RADIO BUTTON,I WANT TO DELETE THAT CORRESPONDING ROW BUT WITHOUT DELETING FROM THE DATABASE.hOW IS IT POSSIBLE?IF U HAVE ANY IDEA,PLS REPLY ME.IT'S URGENT.

TYHANKS
MONIKA

 
Old September 22nd, 2006, 06:58 AM
Registered User
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You must cover grid and verify if RADIO BUTTON this false, something of this:
'VERY IMPORTANT the radio button need configure AutoPostback=true
 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        If Not Page.IsPostBack Then
            Dim conn As New SqlConnection("Integrated Security=SSPI;Persist Security Info=False;User ID=Sacoor/jose fidalgo;Password=jcf2004.,;Initial Catalog=Loja1601;Data Source=PC03-INFO")
            conn.Open()
            Dim st As String = "select ref,codigo=codpor from u_promocao where ref like '2%'"
            Dim adapt As New SqlDataAdapter(st, conn)
            Dim ds As New DataSet
            adapt.Fill(ds, "Promo")
            Session("mytab") = ds.Tables("Promo")
            Me.DataGrid1.DataSource = Session("mytab")
            Me.DataBind()

        Else
            Dim litem As DataGridItem
            Dim tabaux As New DataTable
            With tabaux.Columns
                .Add("ref", GetType(System.String))
                .Add("codigo", GetType(System.String))
            End With

            Dim myrow As DataRow

            For Each litem In Me.DataGrid1.Items
                Dim rd As New RadioButton
                rd = CType(litem.FindControl("radio"), RadioButton)
                If rd.Checked = False Then

                    myrow = tabaux.NewRow
                    myrow("ref") = litem.Cells(1).Text
                    myrow("codigo") = litem.Cells(2).Text
                    tabaux.Rows.Add(myrow)
                End If

            Next
            Dim cloneTable As DataTable
            Dim mr As DataRow
            CType(Session("mytab"), DataTable).Clear()
            For Each mr In tabaux.Rows
                CType(Session("mytab"), DataTable).ImportRow(mr)
            Next
            Me.DataGrid1.DataSource = Session("mytab")
            Me.DataGrid1.DataBind()


        End If

    End Sub

I wait that it helps






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with datagrid Shishir ASP.NET 1.0 and 1.1 Professional 1 January 6th, 2007 09:01 AM
Datagrid Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 1 December 5th, 2006 03:09 AM
DataGrid Problem anujrathi VB.NET 2002/2003 Basics 2 June 15th, 2006 02:18 AM
DataGrid Problem anujrathi ASP.NET 2.0 Basics 1 June 12th, 2006 03:52 PM
Datagrid problem dotnetprogrammer VS.NET 2002/2003 1 February 17th, 2005 05:11 AM





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