Asp.net ASP CascadingDropDown控件导致IE脚本超时
在加载页面之前,我使用一个子例程将DropDownList控件链接在一起:Asp.net ASP CascadingDropDown控件导致IE脚本超时,asp.net,asp.net-ajax,drop-down-menu,ajaxcontroltoolkit,cascadingdropdown,Asp.net,Asp.net Ajax,Drop Down Menu,Ajaxcontroltoolkit,Cascadingdropdown,在加载页面之前,我使用一个子例程将DropDownList控件链接在一起: Private Sub CreateCascadingDropDown(ByVal category As String, ByRef parentDDL As DropDownList, ByRef targetDDL As DropDownList) Dim CDDL As New CascadingDropDown With CDDL
Private Sub CreateCascadingDropDown(ByVal category As String, ByRef parentDDL As DropDownList, ByRef targetDDL As DropDownList)
Dim CDDL As New CascadingDropDown
With CDDL
.Category = category
If Not parentDDL Is Nothing Then
parentDDL.Items.Clear()
.ParentControlID = parentDDL.ID
End If
targetDDL.Items.Clear()
.TargetControlID = targetDDL.ID
.PromptText = SharedWeb.GC_SELECTONE
.PromptValue = "-1"
.LoadingText = "Please wait..."
.ServicePath = "/ajax/InvestmentProcess.asmx"
.ServiceMethod = "GetTaxo"
End With
'Page.ClientScript.RegisterForEventValidation(CDDL.UniqueID)
targetDDL.Parent.Controls.Add(CDDL)
End Sub
调用web服务方法时,它将执行以下代码。根据类别,它从适配器获取适当的数据
<WebMethod()> _
Public Function GetTaxo(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim log As ILog = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
log.Debug("GetSegmentTaxonomy(" + category + ") -> {" + knownCategoryValues + "}")
Dim kv As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)
Dim adapter As New SegmentTaxonomyTableAdapters.SEGMENT_ARCHITECTURE_TableAdapter
Dim rows As DataRowCollection
Select Case category
Case InvestmentEdit.ST_SEG_ARCH
rows = New SegmentTaxonomyTableAdapters.SEGMENT_ARCHITECTURE_TableAdapter().GetData().Rows
Case InvestmentEdit.ST_LOB
If kv.ContainsKey(InvestmentEdit.ST_SEG_ARCH) Then
log.Debug("found seg architecture - > " + kv(InvestmentEdit.ST_SEG_ARCH))
rows = New SegmentTaxonomyTableAdapters.LINE_OF_BUSINESSTableAdapter().GetData(kv(InvestmentEdit.ST_SEG_ARCH)).Rows
End If
End Select
If Not rows Is Nothing Then
Dim results As New List(Of CascadingDropDownNameValue)
For Each row As DataRow In rows
log.Debug("ROW >>>> " + row("lov_label").ToString() + " : " + row("lov_cd").ToString())
results.Add(New CascadingDropDownNameValue(row("lov_label"), row("lov_cd")))
Next
Return results.ToArray
End If
Return Nothing
End Function
但当我链接第二个下拉控件时,Internet Explorer会给出一个脚本超时。如果我一直允许脚本运行,它只会一直给我提示。如果选择停止运行脚本,则会出现方法错误12031或错误500(是的,我的web服务文件中有ScriptService()声明)。你知道是什么原因吗?事实证明,我只需要从Ajax控件工具包中添加以下控件:
<ajax:ToolkitScriptManager ID="tsm" runat="server" />
<ajax:ToolkitScriptManager ID="tsm" runat="server" />
.TargetControlID = targetDDL.UniqueId