Hi,
I have the contentview name saved in my database for every specific category and I am saving it into a variable called page_code.
In Below code, I am trying to Add the contentview using the variable page_code
INavigation navService;
navService = App.Current.MainPage.Navigation;
var targetPageType = Type.GetType("Zeera." + page_code);
var targetPageInstance = (View)Activator.CreateInstance(targetPageType, "test");
GridNewAdDetails.Children.Add(targetPageInstance);
but I am getting below error:
System.MissingMethodException: Constructor on type 'Zeera.NewPostPet' not found.
at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x001bf] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/rttype.cs:5535
at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00083] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/activator.cs:107
at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/activator.cs:112
at Zeera.NewPost.ButtonNewAdNext_Clicked (System.Object sender, System.EventArgs e) [0x00311] in /Users/jassim/Projects/Zeera/Zeera/NewPost.xaml.cs:244
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178
at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65
at Zeera.iOS.Application.Main (System.String[] args) [0x00001] in /Users/jassim/Projects/Zeera/Zeera.iOS/Main.cs:17
Kindly help..
Thanks,
Jassim