当 ASPxPageControl 选项卡页位于两个 ASPxPageControl 标签页中时,我无法访问该组件
I can't access ASPxComboBox component when it is in both ASPxPageControl tab pages
当ASPxPageControl两个标签页中时,我无法访问ASPxComboBox组件。所以我用字符串将这个函数添加到客户端事件中。格式:
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 apears在两个选项卡上打开。
更多背景:
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)
您应该设置在客户端使用的所有控件的 ClientInstanceName。
<dx:ASPxCallbackPanel ClientInstanceName="cbPanel1" ...>
<dx:ASPxHyperLink ClientInstanceName="hyperlink1" ..../>
然后:
function(s, e) {{
if (window.{0}) {{
{0}.SetSelectedItem(
{0}.FindItemByText(
{1}.GetText()
)
);
{0}.Focus();
{2}.PerformCallback(
{0}.GetSelectedItem().value
);
}}
}}
哪里:
0 - 组合框客户端实例名称
1 - 超链接客户端实例名称
2 - 回调面板客户端实例名称
你真的应该访问Niranjan发布的链接。