| | |
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 .net2005 30minutes 2005 2008 access account arithmetic array assignment basic binary bing box button buttons center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist excel file-dialog firewall folder ftp google hardcopy image images insert isnumericfuntioncall login math memory mobile ms navigate net networking opacity output passingparameters peertopeervideostreaming picturebox picturebox1 port print problemwithinstallation project record reports" save savedialog searchbox serial soap sorting string table tcp temp text textbox timer toolbox trim update updown useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio web wpf





