<AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.Read)> _
Public Function HandleSelect(ByVal table As String, ByVal eventSource As String, ByVal filterValue As String, ByVal targetControl As String) As StreetNameResponse
Dim tName As TableName
Dim filter As String = Nothing
Dim sort As String = Nothing
Dim textField As String = Nothing
Dim valueField As String = Nothing
Dim name As String = Nothing
Dim onChange As String = Nothing
'Assign security filter
CheckSecurityFilter()
Select Case table.ToLower
Case "county"
tName = TableName.County
If filterValue = "-1" Or filterValue = "" Then
If _restrictionLevel = RestrictionLevel.District Then
filter = _restrictionFilter
End If
Else
filter = String.Format("maintdisnmbr in ({}0)", filterValue)
End If
tName = TableName.County
sort = "countyname ASC"
textField = "countyname"
valueField = "countynmbr"
name = "selCounty"
onChange = "CheckSubmitEnabled();ajaxGetSelect('city','county', this, 'spanCity')"
Case "city"
If filterValue = "-1" Or filterValue = "" Then
'No value selected, set the filter to the default security value
If _restrictionLevel = RestrictionLevel.District Or _restrictionLevel = RestrictionLevel.County Then
filter = _restrictionFilter
End If
Else
Select Case eventSource.ToLower
Case "district"
filter = String.Format("maintdisnmbr in ({0})", filterValue)
Case "county"
filter = String.Format("countynmbr in ({0})", filterValue)
End Select
End If
tName = TableName.MasterCity
sort = "sams_cityname ASC"
textField = "sams_cityname"
valueField = "cityname_value"
name = "selCity"
onChange = "CheckSubmitEnabled()"
End Select
Dim selOutput As HtmlSelect = BuildSelect(tName, filter, sort, textField, valueField, name, onChange)
Dim outControl As New StreetNameResponse
outControl.targetControl = targetControl
outControl.outputControl = selOutput
MyBase.ProperCaseSelectControl(selOutput)
Return outControl
End Function
中途停在我有問題,調試上面的代碼。這一點是在HTML中我有三個選擇標籤。區,縣和城市。如果你選擇一個地區,它應該更新縣和市來限制該地區的縣或城市。城市完美,但縣沒有。我發現,如果它運行在上面的代碼中,如果它通過County Case段運行,它就會停止filter = String.Format(「{} 0」中的maintdisnmbr),filterValue)。如果我一步一步地完成代碼的話。如果我不一步一步地向前跳,它會給我一個錯誤,說明輸入字符串沒有格式化。這不是我的代碼,我沒有與Ajax合作,但我必須解決它,請任何幫助,至少找出問題會很好。Ajax調用通過代碼
這看起來將是容易受到SQL注入攻擊。壞碼猴。沒有cookie。 – 2012-01-31 04:33:00