Click here to Skip to main content
15,868,420 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
(Using Teleriks' RadPageView)

I have a Method inside a usercontrol which creates and populates a "RadPageView".

public void CreateDemoMap()
{
    RadPageViewPage pTest = new RadPageViewPage();
    pTest.Text = "Live Map (Demo)";
    radPageViewX.Pages.Add(pTest);
    WebMap wMap = new WebMap();
    pTest.Controls.Add(wMap);
    MessageBox.Show("TEST");
}


From the same form but outside of the user control I have a button calling on the Method.

C#
private void radButtonElement4_Click_1(object sender, EventArgs e)
{
    ProjectDashControl PDC = new ProjectDashControl();
    PDC.CreateDemoMap();
}


The method does run (Textbox Shows "Test") But the RadPageView does not generate.
Running the method localy - I get the intended results and it works fine.

C#
public ProjectDashControl()
{
    InitializeComponent();
    CreateDemoMap();
}


So I'm not sure how to fix this; or for that matter what the issue is; Is the instance i'm creating taking presedence over the latter? Not running with-in the form? Suggestions or Answers Appreciated - Thanks in Advance.
Posted
Comments
Sergey Alexandrovich Kryukov 17-Jun-11 14:34pm    
Not ***fully*** running?!! This is the first time I hear about such a weird concept!
--SA

You have to move variable ProjectDashControl PDC to global scope of your class or else GC will collect PDC when the method radButtonElement4_Click_1 ends.
 
Share this answer
 
Comments
RaiinMedia 20-Jun-11 11:02am    
This unfortunatly doesnt work, It still shows a MessageBox. But doesn't create the RadPage.
Moved Variable ProjectDashControl PDC to Global Scope and Changed to Instance.


ProjectDashControl PDC = ProjectDashControl.Instance();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900