I think the titel says it all: I have a UserControl inside my Page. How can I get a reference to the Page where the UserControl is in?
You can get a reference to the current Page with
(Window.Current.Content as Frame).Content as Page
Related
I have been looking thru the many posts on calling a method on the parent page from the user control. However my user control is nested inside another user control which is on the parent page. How can i call the method from the parent page from with in this nested control?
All web controls inherit the WebControl which has a property called Page that can be used to the get a reference to the control's page.
As such you can simply use:
Dim ParentPage as Page = MyUserControl.Page
I have a custom New/Edit form that renders the edit controls using the FieldRendering control property of the fields. When the list and form are at the first level subsite (RootSite/SubSite1) of a SharePoint site collection. It works just fine.
When I try to use the same code to render the form in another first level subsite (RootSite/SubSite2) of the site collection, a sibling of the first site, the edit controls do not render. I have the code in (RootSite/Subsite2) and the list is still in (RootSite/SubSite1). I got a hint that RootFolder parameter might help but that did not work out. Any Ideas?
Thanks
I this case you can open the root site as follows:
using (SPSite oSPsite = new SPSite(SPContext.Current.Site.RootWeb.Url))
{
using (SPWeb oSPWeb = oSPsite.OpenWeb())
{
I am trying to redirect page on Button click of infopath form using the below code:
HttpContext.Current.Response.Redirect("http://www.google.com", true);
But i am getting this error:
"Object reference not set to an instance of an object."
Does it help you ?
HttpContext.Current.Response.Redirect("http://www.google.com", false);
Take a look here,
http://mfawazsp.blogspot.in/2010/02/problem-with-responseredirect-in.html
or/and this,
Need inputs for logic for Codebehind in Infopath Button
or/and this,
http://social.technet.microsoft.com/Forums/sk/sharepoint2010programming/thread/16c7f7c5-545e-4375-b093-91da23041624
In my apllication there are two from.The default form that is the MainPage.xaml and another form called login.xaml.
I have a button on MainPage.xaml,and my requirement is when the user click that button the Login page should be navigated.
This is my first experience in silverlight can i get that easily understandable code.
this.NavigationService.Navigate(new Uri("/Pagename", UriKind.RelativeOrAbsolute));
In this give your xaml or aspx (/Pagename) only no need to mention .xaml or .aspx
Instead of navigating, you could use a Childwindow
Otherwise, I think, you would have to use the Silverlight navigation framework, but this is quite complex. I'd suggest you to first have a child window pop up if you want to do something!
On Button Event
this.Content=new Login();
I've got a MainPage.xaml page a Detail.xaml page.
I've passed variables to the Detail.xaml from MainPage.xaml by using a static variable and referencing it in Detail.xaml (the detail page is acting like a dialog). However once I've updated the content of another object, I want to call a method in MainPage.xaml to refresh the content of that page using the updated object from the Detail.xaml page.
I assume I am not using the correct paradigm for this and should probably be using MVVM or something but I'm not familiar with the implementation and was hoping there was a simple way to do this?
Can you load the content from the static into your control in the OnNavigatedTo?
You can make a method in your main page to do that job and call that.