Bug When Tab Has space

3 posts, 1 answers
  1. Najid Hanif
    Najid Hanif avatar
    92 posts
    Member since:
    Jul 2011

    Posted 30 May 2012 Link to this post

    Hi I think I found a bug. When the page has a tab with a space and there are controls that have data validation (RequiredFieldValidator & CustomValidator) stuff blows up ;)
    I can fix the issue by removing the space in the tab name.

    I am creating the tabs in my code behind as follows:

    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            AddTab("Software Test Requirements");
            AddPageView(RadTabStrip1.FindTabByText("Software Test Requirements"));
            AddTab("System Requirements");
            AddTab("Application Contacts");
            AddTab("Discussions");
            AddTab("Links");
            AddTab("Approvals");
        }
    }
     
    private void AddTab(string tabName)
    {
        RadTab tab = new RadTab();
        tab.Text = tabName;
        RadTabStrip1.Tabs.Add(tab);
    }
     
     
     
    protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
    {
     
        string userControlName;
        switch (e.PageView.ID)
        {
            case "Software Test Requirements":
                userControlName = "ReleaseSoftwareRequirementsForm.ascx";
                break;
            case "System Requirements":
                userControlName = "ReleaseSoftwareRequirementsSysReqs.ascx";
                break;
            case "Application Contacts":
                userControlName = "ReleaseSoftwareRequirementsTechContacts.ascx";
                break;
            case "Discussions":
                userControlName = "ReleaseSoftwareRequirementsDiscussions.ascx";
                break;
            case "Links":
                userControlName = "ReleaseSoftwareRequirementsLinks.ascx";
                break;
            case "Approvals":
                userControlName = "ReleaseSoftwareRequirementsApprovals.ascx";
                break;
            default:
                userControlName = "ReleaseSoftwareRequirementsForm.ascx";
                break;
        }
     
     
     
     
        Control userControl = Page.LoadControl(userControlName);
        userControl.ID = e.PageView.ID + "_userControl";
     
        e.PageView.Controls.Add(userControl);
    }
     
    private void AddPageView(RadTab tab)
    {
        RadPageView pageView = new RadPageView();
        pageView.ID = tab.Text;
        RadMultiPage2.PageViews.Add(pageView);
        pageView.CssClass = "pageView";
        tab.PageViewID = pageView.ID;
    }
     
    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
    {
        AddPageView(e.Tab);
        e.Tab.PageView.Selected = true;
    }


    I will add a couple of screen shots, let me know if you need more or if this is just something dumb I am doing.

    Thanks!
  2. Answer
    Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 30 May 2012 Link to this post

    Hello Najid,

    I don't understand how your code doesn't through an ASP.NET error when running because you can't set a control's id to something with spaces.

    I think you should remove the spaces before passing it as the id for the PageView. This would also require your case statement to be written differently.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Najid Hanif
    Najid Hanif avatar
    92 posts
    Member since:
    Jul 2011

    Posted 30 May 2012 Link to this post

    Hey Kevin thanks! Yep your right I just needed to strip out the space when I give the ID to the control.

    Thanks!
Back to Top