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

Prevent Multiple Tabs

7 Answers 53 Views
PageView
This is a migrated thread and some comments may be shown as answers.
RS
Top achievements
Rank 1
RS asked on 20 Apr 2014, 10:31 AM
Hello!
I have a radform with a button, when I click it, a usercontrol form opens in a tab inside the radpageview, all nice, but if I click the same button, the same usercontrol open in another tab.. so, the question is, how I can prevent this? for example instead of open the same tab, maybe it can focus to the tab that is already open with the usercontrol in it,

this is the basic code for my button:

1.RadPageViewPage page = new RadPageViewPage();
2.UserControl1 uc = new UserControl1();
3. 
4.page.Text = "Page Test ";
5.radPageView1.Pages.Add(page);
6.page.Controls.Add(uc);
7.radPageView1.SelectedPage = page;


what type of if statement do I need here?

Thanks!
btw, amazing job with this .net toolbox! Thanks!

7 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 21 Apr 2014, 12:38 PM
Hi RS Bauer,

Thank you for writing.

In this case you can use the following if statement:
private void radButton1_Click(object sender, EventArgs e)
{
    if (radPageView1.Pages.Contains("Test Page"))
    {
        radPageView1.SelectedPage = radPageView1.Pages["Test Page"];
    }
    else
    {
        RadPageViewPage page = new RadPageViewPage();
        UserControl1 uc = new UserControl1();
        page.Name = "Test Page";
        page.Text = "Page Text";
        radPageView1.Pages.Add(page);
        page.Controls.Add(uc);
        radPageView1.SelectedPage = page;
    }
}

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
RS
Top achievements
Rank 1
answered on 21 Apr 2014, 03:03 PM
Nice! It works great! That's what I was looking for! Thank you very much Dimitar! Excellent support!
and yes, there is something else, I need to run some code when my tab is close, so I'll need to "capture" the click of the close tab button of each page. I don't know if I have to create another thread for this question because is a different topic.. but anyways, thank you! (Y)
0
Accepted
Dimitar
Telerik team
answered on 22 Apr 2014, 10:44 AM
Hello,

Thank you for writing back.

In this case you can use the PageRemoved/PageRemoving events. For example you can subscribe to the PageRemoved event like this:
public Form1()
{
    InitializeComponent();
    radPageView1.PageRemoved += radPageView1_PageRemoved;
}
 
void radPageView1_PageRemoved(object sender, RadPageViewEventArgs e)
{
     
}

Also, I would like to kindly ask you in future, to separate the questions that are not related to each other in separate threads in order to make them easily accessible for the community.
 
Do not hesitate to contact us if you have other questions.
 
Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
RS
Top achievements
Rank 1
answered on 23 Apr 2014, 02:24 PM
Thank you Dimitar! Works great! and again, sorry for the double topic!
0
nestodre
Top achievements
Rank 1
answered on 12 Mar 2015, 02:25 AM
I've got a problem like this too. I just want to expand only one page, so I did like your advise Dimitar.
But the page still is not expanded, only the header is highlighted.
I have scrolled all method of the RadPageViewPage but I didn't found any function can help me to expand the content of RadPageViewPage.
0
nestodre
Top achievements
Rank 1
answered on 12 Mar 2015, 03:27 AM
radPageView1.SelectedPage = radPageView1.Pages["Test Page"];
I've tried to use this code with some different view modes, and I found that this line does not work with ExplorerBar view mode in RadPageView, but it works well with the others view mode.
Can you suggest me some way to expand the page when I use ExplorerBar view mode?
Thanks you,
0
Stefan
Telerik team
answered on 12 Mar 2015, 07:32 AM
Hello,

I have answered your question in the other thread you have posted on the matter: http://www.telerik.com/forums/radpageviewpage-on-mouseover-event.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PageView
Asked by
RS
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
RS
Top achievements
Rank 1
nestodre
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or