当它在 ASPxPageControl 两个标签页中时,我无法访问 ASPxComboBox 组件。所以我用string.Format将此函数添加到ClientSideEvents:
function(s, e) {{
if (window['{1}']) {{
{0}.SetSelectedItem(
{0}.FindItemByText(
{2}.GetText()
)
);
{0}.Focus();
{3}.PerformCallback(
{0}.GetSelectedItem().value
);
}}
}}
并首先在一个标签页然后在另一页触发此功能,我收到错误:
Microsoft JScript runtime error: Unable to get value of the property 'SetSelectedItem': object is null or undefined
为什么会这样?切换标签后我可以以某种方式访问该组合框吗?
顺便说一句,ASPxPopupControl 出现在两个选项卡上,然后打开..
更多背景:
0 is ASPxClientControl.GetControlCollection().Get('<%=ASPxComboBox_Views.ClientID%>'), (compiles to ctl00_ctl00_ASPxSplitter_Main_ContentPlaceHolderMain_ContentProgramMain_ASPxRoundPanelMain_ASPxPageControl_Main_ASPxCallbackPanel_Redagavimas_ASPxCallbackPanel_RedagavimasGrid_GridLayout_Redagavimas_ASPxPopupControl_Layout_ASPxCallbackPanel_Views_ASPxComboBox_Views )
1 is ASPxClientControl.GetControlCollection().Get('<%=ASPxComboBox_Views.ClientInstanceName%>'), (compiles to cbViews )
2 is ASPxClientControl.GetControlCollection().Get('<%=GetClientStr(ASPxHyperLink_Desc.ClientID%>'), (compiles to ctl00_ctl00_ASPxSplitter_Main_ContentPlaceHolderMain_ContentProgramMain_ASPxRoundPanelMain_ASPxPageControl_Main_ASPxCallbackPanel_Redagavimas_ASPxCallbackPanel_RedagavimasGrid_GridLayout_Redagavimas_ASPxHyperLink_Desc )
3 is ASPxClientControl.GetControlCollection().Get('<%=ASPxCallbackPanel_Menu.ClientID%>'), (compiles to ctl00_ctl00_ASPxSplitter_Main_ContentPlaceHolderMain_ContentProgramMain_ASPxRoundPanelMain_ASPxPageControl_Main_ASPxCallbackPanel_Redagavimas_ASPxCallbackPanel_RedagavimasGrid_GridLayout_Redagavimas_ASPxPopupControl_Layout_ASPxCallbackPanel_Menu )
如果 ASPxComboBox_Views 位于 ASPxPageControl 选项卡中,则它不起作用。准确地说,我的页面如下所示:
<..>
<dx:ASPxPageControl ID="ASPxPageControl_Main">
<TabPages>
<dx:TabPage><..>
<dx:ASPxGridView ID="ASPxGridView_Naudojimas">
//From here starts partial page which is one for both tabpages
<dx:ASPxPopupControl ID="ASPxPopupControl_Layout">
<ContentCollection>
<dx:PopupControlContentControl ID="PopupControlContentControl_Layout">
<div><table><tr><td align="left" width="100%">
<dx:ASPxCallbackPanel ID="ASPxCallbackPanel_Views">
<PanelCollection>
<dx:PanelContent ID="PanelContent1">
<dx:ASPxComboBox ID="ASPxComboBox_Views" runat="server" ...>
</dx:TabPage>
<dx:TabPage><..>
<dx:ASPxGridView ID="ASPxGridView_Redagavimas">
//From here starts partial page which is one for both tabpages
<dx:ASPxPopupControl ID="ASPxPopupControl_Layout">
<ContentCollection>
<dx:PopupControlContentControl ID="PopupControlContentControl_Layout">
<div><table><tr><td align="left" width="100%">
<dx:ASPxCallbackPanel ID="ASPxCallbackPanel_Views">
<PanelCollection>
<dx:PanelContent ID="PanelContent1">
<dx:ASPxComboBox ID="ASPxComboBox_Views" runat="server" TextField="Description" ValueField="FullName" ClientInstanceName="cbViews" TextFormatString="{0}">
(deleted some properties just to be easier to read here)