Ajax Combo Box Problem with Ajax tab Container

Last post 08-10-2009 12:58 AM by twebb72. 7 replies.

Sort Posts:

  • Ajax Combo Box Problem with Ajax tab Container

    06-10-2009, 8:29 AM
    • Member
      point Member
    • basil1186
    • Member since 06-10-2009, 12:11 PM
    • Mumbai
    • Posts 6

    Hey, I m using Ajax New Combo box control in my Web Application for Some Auto Complete operation.I have some combo boxes in Tab Container panel 3.but it shows me some invalid argument  error regarding to b.Width while rendering the control on Page.Whereas the combo boxes in Panel 1 working fine..

    Can anyone suggest me any solution for this...?

    Thank you.

  • Re: Ajax Combo Box Problem with Ajax tab Container

    06-16-2009, 5:14 AM

    Hi basil1186,

    I have built a test application, please refer to this code: 

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestInTabPanel.aspx.vb"
        Inherits="SoluTest_ComboBox.TestInTabPanel" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="2">
                <cc1:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1">
                    <ContentTemplate>
                    </ContentTemplate>
                </cc1:TabPanel>
                <cc1:TabPanel runat="server" HeaderText="TabPanel2" ID="TabPanel2">
                    <ContentTemplate>
                    </ContentTemplate>
                </cc1:TabPanel>
                <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3">
                    <ContentTemplate>
                        <cc1:ComboBox ID="cbItems" runat="server" DropDownStyle="DropDownList" AutoCompleteMode="Suggest"
                            CssClass="" AppendDataBoundItems="false">
                            <asp:ListItem>Fox</asp:ListItem>
                            <asp:ListItem>1231</asp:ListItem>
                            <asp:ListItem>dsgadsg</asp:ListItem>
                            <asp:ListItem>4rjh56jh</asp:ListItem>
                        </cc1:ComboBox>
                    </ContentTemplate>
                </cc1:TabPanel>
            </cc1:TabContainer>
        </div>
        </form>
    </body>
    </html>
    Best regards,

    Zhi-Qiang Ni

     

    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
  • Re: Ajax Combo Box Problem with Ajax tab Container

    06-16-2009, 6:02 AM
    • Member
      point Member
    • basil1186
    • Member since 06-10-2009, 12:11 PM
    • Mumbai
    • Posts 6

    Hey

    Thanks Zhiiii for ur post...but still i m facing the same problem even i have tried ur code tooo.

    U do one thing set the ActiveTabIndex for the tab container as 0 and i hope u'll get the same error 

    <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">

  • Re: Ajax Combo Box Problem with Ajax tab Container

    06-16-2009, 6:26 AM
    Answer

    Hi basil1186,

    I can reproduce this issue based on your description. Try to reset the ActiveTabIndex in the client pageLoad event. 

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestInTabPanel.aspx.vb"
        Inherits="SoluTest_ComboBox.TestInTabPanel" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    
        <script type="text/javascript">
            function pageLoad() {
                var tab = $find("TabContainer1");
                tab.set_activeTabIndex(0);
            }
        </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="2">
                <cc1:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1">
                    <ContentTemplate>
                    </ContentTemplate>
                </cc1:TabPanel>
                <cc1:TabPanel runat="server" HeaderText="TabPanel2" ID="TabPanel2">
                    <ContentTemplate>
                    </ContentTemplate>
                </cc1:TabPanel>
                <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3">
                    <ContentTemplate>
                        <cc1:ComboBox ID="cbItems" runat="server" DropDownStyle="DropDownList" AutoCompleteMode="Suggest"
                            CssClass="" AppendDataBoundItems="false">
                            <asp:ListItem>Fox</asp:ListItem>
                            <asp:ListItem>1231</asp:ListItem>
                            <asp:ListItem>dsgadsg</asp:ListItem>
                            <asp:ListItem>4rjh56jh</asp:ListItem>
                        </cc1:ComboBox>
                    </ContentTemplate>
                </cc1:TabPanel>
            </cc1:TabContainer>
        </div>
        </form>
    </body>
    </html>
    Best regards,

    Zhi-Qiang Ni

    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
  • Re: Ajax Combo Box Problem with Ajax tab Container

    06-16-2009, 8:28 AM
    • Member
      point Member
    • basil1186
    • Member since 06-10-2009, 12:11 PM
    • Mumbai
    • Posts 6

    Nop....Its not working Zhi

    Basically the tab panel which is not visible and contains combo box makes the problem.try n putting combo boxes in multiple panels.

    And 2nd thing...It executes Page_Load event properly but while rendering control it throws java script error.where he gets some width in negative.

  • Re: Ajax Combo Box Problem with Ajax tab Container

    06-16-2009, 11:01 PM

    Hi basil1186,

    The cause of this issue is when the TabContainer is rendered, the visible property of the controls inside the hidden TabPanel may be set as false. That is why the ComboBox is rendered in error if it is placed in to the hidden TabPanel. My last reply is a workaround which is setting the ComboBox’s TabPanel as the selected Tab firstly, and then changing the TabIndex to the others in the client pageLoad function.

    If there are many ComboBoxes in each hidden TabContainer, I recommend you add the ComboBox from code behind side.

    .aspx file 

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestInTabPanel.aspx.vb"
        Inherits="SoluTest_ComboBox.TestInTabPanel" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" AutoPostBack="True">
                        <cc1:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1">
                            <ContentTemplate>
                            </ContentTemplate>
                        </cc1:TabPanel>
                        <cc1:TabPanel runat="server" HeaderText="TabPanel2" ID="TabPanel2">
                            <ContentTemplate>
                            </ContentTemplate>
                        </cc1:TabPanel>
                        <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3">
                            <ContentTemplate>
                            </ContentTemplate>
                        </cc1:TabPanel>
                    </cc1:TabContainer>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        </form>
    </body>
    </html>
    .aspx.vb file 
    Imports AjaxControlToolkit
    
    Partial Public Class TestInTabPanel
        Inherits System.Web.UI.Page
    
        Private Sub TabContainer1_ActiveTabChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabContainer1.ActiveTabChanged
            If TabContainer1.ActiveTabIndex = 1 Then
    
                Dim ComboBox1 As New ComboBox
                ComboBox1.ID = "ComboBox1"
                ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
                ComboBox1.AutoCompleteMode = ComboBoxAutoCompleteMode.Suggest
                ComboBox1.AppendDataBoundItems = False
                ComboBox1.Items.Add("111111")
                ComboBox1.Items.Add("111111")
                ComboBox1.Items.Add("sdgferg")
                ComboBox1.Items.Add("vcvdb")
    
            ElseIf TabContainer1.ActiveTabIndex = 2 Then
    
                Dim ComboBox2 As New ComboBox
                ComboBox2.ID = "ComboBox2"
                ComboBox2.DropDownStyle = ComboBoxStyle.DropDownList
                ComboBox2.AutoCompleteMode = ComboBoxAutoCompleteMode.Suggest
                ComboBox2.AppendDataBoundItems = False
                ComboBox2.Items.Add("22222")
                ComboBox2.Items.Add("22222")
                ComboBox2.Items.Add("465465")
                ComboBox2.Items.Add("3e2r3r2")
    
            End If
        End Sub
    End Class
    Best regards,

    Zhi-Qiang Ni

    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
  • Re: Ajax Combo Box Problem with Ajax tab Container

    06-17-2009, 1:00 AM
    • Member
      point Member
    • basil1186
    • Member since 06-10-2009, 12:11 PM
    • Mumbai
    • Posts 6

    Thanks for ur reply..

    Adding Combo boxes runtime will surely work...but again speed issue will arrise..coz i m  binding 7 to 8 combo boxes in three different tabs from Database..again tab container itself its a heavy controls..It could kill my WebSite...do we have any alternate solution for this?...or we have to wait until next release of Ajax Control Toolkit.

  • Re: Ajax Combo Box Problem with Ajax tab Container

    08-10-2009, 12:58 AM
    • Member
      4 point Member
    • twebb72
    • Member since 10-12-2007, 2:03 AM
    • Posts 2

    I found a quick work around.

    On Page_Load leave your combo boxes Visible = false;

    This way it won't render on the page and throw the javascript error. When the user clicks on the correct tab, then choose to Visible = true the ComboBox.

    Its server heavy, but its meant to be a workaround. IMO microsoft ajax isn't good to use in Enterprise apps anyway, so this solution is probably ok for most.

Page 1 of 1 (8 items)