I am encountering an issue with accessing the ASPxComboBox component when it is within an ASPxPageControl that has multiple tab pages. To handle this, I have added a function to the ClientSideEvents using string.Format:
function(s, e) {{
if (window['{1}']) {{
{0}.SetSelectedItem(
{0}.FindItemByText(
{2}.GetText()
)
);
{0}.Focus();
{3}.PerformCallback(
{0}.GetSelectedItem().value
);
}}
}}
However, upon firing this function on one tab page and then switching to another, I encounter the following error:
Microsoft JScript runtime error: Unable to get value of the property 'SetSelectedItem': object is null or undefined
I am wondering why this error occurs and if there is a way to access the combobox after switching tabs. Additionally, I have an ASPxPopupControl appearing on both tabs when opened.
For further context, here are some additional details:
0 refers to ASPxClientControl.GetControlCollection().Get('<%=ASPxComboBox_Views.ClientID%>');
1 refers to ASPxClientControl.GetControlCollection().Get('<%=ASPxComboBox_Views.ClientInstanceName%>');
2 refers to ASPxClientControl.GetControlCollection().Get('<%=GetClientStr(ASPxHyperLink_Desc.ClientID%>');
3 refers to ASPxClientControl.GetControlCollection().Get('<%=ASPxCallbackPanel_Menu.ClientID%>');
It seems that the issue arises when the ASPxComboBox_Views is placed within the ASPxPageControl tab structure. Here is how my page layout looks:
<..>
<dx:ASPxPageControl ID="ASPxPageControl_Main">
<TabPages>
<dx:TabPage>
// Content for first tab
<dx:ASPxGridView ID="ASPxGridView_Naudojimas">
<dx:ASPxPopupControl ID="ASPxPopupControl_Layout">
...
// Partial content shared between tabs starts from here
<dx:ASPxComboBox ID="ASPxComboBox_Views" runat="server" ...>
</dx:TabPage>
<dx:TabPage>
// Content for second tab
<dx:ASPxGridView ID="ASPxGridView_Redagavimas">
<dx:ASPxPopupControl ID="ASPxPopupControl_Layout">
...
// Partial content shared between tabs starts from here
<dx:ASPxComboBox ID="ASPxComboBox_Views" runat="server" TextField="Description" ValueField="FullName" ClientInstanceName="cbViews" TextFormatString="{0}">
...