FW: How to do a multiple select and update in a datagrid

W

Wolffang

From: "Wolffang" <[email protected]>
Subject: How to do a multiple select and update in a datagrid
Date: 23 October 2004 21:28

Using Visual studio.net VB

I have a datagrid that brings records from a stored procedure.

Be selecting multiple datarows using a checkbox.
All i want to do is update a field called 'Active' datatype bit from 0 to 1
for all those records that have been selected with the checkbox and mark
another field 'User' with the name of the user who selected these items when
a update button is clicked.

checkbox needs to be disabled if the record of 'Active' is 1

multiselect will be done using the article...
http://www.codeproject.com/aspnet/Multi-select_Dataagrid.asp?

any solutions out there???
 
W

Wolffang

I have a datagrid that has a checkbox...

when a checkboxes are clicked, i am updating the records that are checked...

This is what i have so far.... but i am geting an error.... where the
OrderID is not being passed from the datagrid "dgOrders" to the stored
procedure... but the checkbox is working... is this because i am using
FindControl???

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim dg As DataGridItem

Dim ck As CheckBox

Dim OrdID As Label

Me.SqlConnection1.Open()

For Each dg In dgOrders.Items

ck = dg.FindControl("chkSelect")

OrdID = dg.FindControl("OrderID")



If ck.Checked = True Then

Me.SqlCommand1.Parameters("@OrderID").Value = OrdID

Me.SqlCommand1.Parameters("@AdminUserName").Value = lblUserName.Text

Me.SqlCommand1.Parameters("@AdminProcess").Value = 1

Me.SqlCommand1.ExecuteNonQuery()

End If

Next

Me.SqlConnection1.Close()

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,619
Members
45,316
Latest member
naturesElixirCBDGummies

Latest Threads

Top