Generate List of Values
-
28-10-2019 - |
Question
Ok this code is suppose to take the selected rows from a third party data grid and will be passing it to the code behind for a stored proc can be run on it. I need to be able to gather a list of all the selected values so I can pass all values at one time. I am having trouble because everytime the code loops through it deletes my List of the previous value. I am using Javascript to pull the value from the datagrid. and AJAX to pass it over to vb.net
function onRowSelectChange(gridID, elementID) {
var grid = igtbl_getGridById("locationDetailsGrid");
var rows = grid.Rows;
var row = rows.getRowById(elementID);
//if the row exists
if (row != null) {
var ID = row.getCellFromKey("Crash Type").getValue();
//if the row is selected, add it to the selectionSet. otherwise remove it from the selectionSet
if (row.getSelected() == false) {
//delete the record
selectionSet.removeRecord(ID);
}
else {
//add the record
if (selectionSet.getRecord(ID) == null) {
selectionSet.addRecord(ID)
}
}
var crashType = selectionSet.getAllRecords()
var crashTypeString
var x = 0
while (x <= crashType.length - 1) {
if (crashTypeString == null) {
crashTypeString = crashType[x].getUniqueID() + "|"
}
else {
crashTypeString += crashType[x].getUniqueID() + "|"
}
x++;
}
SAMS.CounterMeasureAjaxHandler.GetRecord(crashTypeString, 1);
Public Class CounterMeasureAjaxHandler
Private _crashTypes As New List(Of String)
Public Property CrashTypes() As List(Of String)
Get
Return _crashTypes
End Get
Set(ByVal value As List(Of String))
_crashTypes = value
End Set
End Property
<AjaxPro.AjaxMethod(HttpSessionStateRequirement.ReadWrite)> _
Public Sub GetRecord(ByVal counterMeasureType As String)
CrashTypes.Add(counterMeasureType)
End Sub
End Class
Decided to do it a little different. This helps solve my issue
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow