| | |
need Help in store Datagrid item in an array
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
Hi,
can someone help me to code this ?
I have a dynamic datagrid and I want to insert only one column from selected [checkbox] rows in the datagrid into a SQL-Server table.
I've a working code where I call Add_to_DB function within the loop of Datagrid items, which works, but I don't like that, I know I can store the values in an ArrayList and then just make one DB call to insert all the rows in the table. But I am having hard time coding this, I keep on getting null reference error. I know I am doing something stupid.
please help.
TIA
can someone help me to code this ?
I have a dynamic datagrid and I want to insert only one column from selected [checkbox] rows in the datagrid into a SQL-Server table.
I've a working code where I call Add_to_DB function within the loop of Datagrid items, which works, but I don't like that, I know I can store the values in an ArrayList and then just make one DB call to insert all the rows in the table. But I am having hard time coding this, I keep on getting null reference error. I know I am doing something stupid.
please help.
TIA
VB.NET Syntax (Toggle Plain Text)
Private Sub NextBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextBtn.Click Dim objItem As DataGridItem For Each objItem In SKU_Search_DG.Items ' Ignore invalid items If objItem.ItemType <> ListItemType.Header And _ objItem.ItemType <> ListItemType.Footer And _ objItem.ItemType <> ListItemType.Pager Then ' Retrieve the value of the check box Dim blnChecked As Boolean blnChecked = CType(objItem.Cells(0).FindControl("grid_CheckBox1"), _ CheckBox).Checked If blnChecked = True Then ' add the selected SKU_Id in the array SKU_ID_Array.Add(objItem.Cells(1).Text.Trim()) 'add_selectedSKU(objItem.Cells(1).Text.Trim()) --- commented out End If End If Next Response.Redirect("ApplyDiscount.aspx") End Sub
![]() |
Similar Threads
- remove item in array (C++)
- Using recursion to find largest item in an array (C++)
- Removing an item from head of linked list (C)
- Coverting a string to a byte array (Visual Basic 4 / 5 / 6)
- how to store an array in array (C++)
- how to increase the size of an array? (C)
- Array problem (C)
Other Threads in the VB.NET Forum
- Previous Thread: Filling datarow with combos!
- Next Thread: How do I convert a PrintDocument to a Bitmap?
| Thread Tools | Search this Thread |
"crystal .net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic dosconsolevb.net eclipse editvb.net employees excel exists firewall forms html images isnumericfuntioncall listview map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity open pan pdf picturebox picturebox2 port print printpreview record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter upload useraccounts usercontol vb vb.net vb.nettoolboxvisualbasic2008sidebar vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web wpf wrapingcode xml





