生成值列表

时间:2012-02-21 20:17:56

标签: javascript ajax vb.net

好的,这段代码假设从第三方数据网格中获取所选行,并将其传递给后面的代码,以便可以在其上运行存储过程。我需要能够收集所有选定值的列表,以便我可以一次传递所有值。我遇到了麻烦,因为每次代码循环都会删除我之前值的List。我正在使用Javascript从datagrid中提取值。和AJAX将其传递给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

结束班

决定做一点不同。这有助于解决我的问题

0 个答案:

没有答案