This is a migrated thread and some comments may be shown as answers.

Bug When Tab Has space

2 Answers 39 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Najid Hanif
Top achievements
Rank 2
Najid Hanif asked on 30 May 2012, 06:04 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Kevin
Top achievements
Rank 2
answered on 30 May 2012, 02:17 PM
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.
0
Najid Hanif
Top achievements
Rank 2
answered on 31 May 2012, 03:26 AM
Hey Kevin thanks! Yep your right I just needed to strip out the space when I give the ID to the control.

Thanks!
Tags
TabStrip
Asked by
Najid Hanif
Top achievements
Rank 2
Answers by
Kevin
Top achievements
Rank 2
Najid Hanif
Top achievements
Rank 2
Share this question
or