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
|