How to Get-Set Values to and from a Child Widget

Posted by Community Admin on 04-Aug-2018 19:29

How to Get-Set Values to and from a Child Widget

All Replies

Posted by Community Admin on 23-Jan-2012 00:00

Hi All, need some help with this scenario,

We created some widgets and everything was fine until bump into
the scenario where Widget "A" contains Widget "B"...
In run time (specifically in the ItemDataBound event) need to set some values to the Widget "B" Instance.

01.<asp:ListView ID="lvMostViewedItems" runat="server" DataSourceID="cdsMostViewedItems" >
02.<ItemTemplate>
03.<ul>
04.<li>
05.                                        <div class="scItemOption">
06.                                            <scweb:ItemOptions ID="wucItemOption1" runat="server"  />
07.                                        </div>
08.                                    </li>
09.                                </ul>
10.</ItemTemplate>
11.</asp:ListView>

In Code Behind the Code looks as follow:
1.void PagedControl_ItemDataBound(object sender, ListViewItemEventArgs e)
2. 
3.               ItemOptions wucItemOptions = e.Item.FindControl("wucItemOption1") as ItemOptions;
4.                wucItemOptions.ItemNumber = Convert.ToDecimal(lblitemNo.Text);
5.                wucItemOptions.SmallAddToCartOption = true;
6.

The code finds the wucItemOptions widget but internally the Widget "B" Container fails to set any value.
01.System.InvalidOperationException was unhandled by user code
02.  Message=Invalid PathDefinition.
03.  Source=Telerik.Sitefinity
04.  StackTrace:
05.       at Telerik.Sitefinity.Abstractions.VirtualPath.EmbeddedResourceResolver.GetAssembly(PathDefinition definition)
06.       at Telerik.Sitefinity.Abstractions.VirtualPath.EmbeddedResourceResolver.Open(PathDefinition definition, String virtualPaht)
07.       at Telerik.Sitefinity.Abstractions.VirtualPath.PathDefinition.OpenFile(String virtualPath)
08.       at Telerik.Sitefinity.Abstractions.VirtualPath.VirtualPathManager.OpenFile(String virtualPath)
09.       at Telerik.Sitefinity.Abstractions.VirtualPath.ControlPresentationResolver.Open(PathDefinition definition, String virtualPath)
10.       at Telerik.Sitefinity.Abstractions.VirtualPath.PathDefinition.OpenFile(String virtualPath)
11.       at Telerik.Sitefinity.Abstractions.VirtualPath.VirtualPathManager.OpenFile(String virtualPath)
12.       at Telerik.Sitefinity.Abstractions.VirtualPath.SitefinityVirtualFile.Open()
13.       at System.Web.Hosting.VirtualPathProvider.OpenFile(String virtualPath)
14.       at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
15.       at System.Web.UI.TemplateParser.ParseInternal()
16.       at System.Web.UI.TemplateParser.Parse()
17.       at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
18.       at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
19.       at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
20.       at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
21.       at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
22.       at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
23.       at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
24.       at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
25.       at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
26.       at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(String virtualPath, Type requiredBaseType)
27.       at Telerik.Sitefinity.Web.UI.ControlUtilities.LoadControl(String virtualPath, Page page)
28.       at Telerik.Sitefinity.Web.UI.VirtualPathTemplate.GetInstance(Page page)
29.       at Telerik.Sitefinity.Web.UI.VirtualPathTemplate.InstantiateIn(Control container, PlaceHoldersCollection placeHolders)
30.       at Telerik.Sitefinity.Web.UI.VirtualPathTemplate.InstantiateIn(Control container)
31.       at Telerik.Sitefinity.Web.UI.SimpleView.CreateContainer(ITemplate template)
32.       at Telerik.Sitefinity.Web.UI.SimpleView.get_Container()
33.       at Premier.SmarterCommerceModule.Web.UI.Public.ItemOptions.set_ItemNumber(Decimal value) in C:\SmarterCommerceSVN\4x\4.0.0.0\Trunk\Applications\SmarterCMS\SmarterCommerceModule\Web\UI\Public\ItemOptions.cs:line 390
34.       at ASP.sfctrlpresentation__sfct__369ab264bf820e8e1dd80eea75df7a98e227e32f_websitemostvieweditems_ascx.__BuildControlwucItemOption2() in http://server/SfCtrlPresentation/_SFCT_/369ab264bf820e8e1dd80eea75df7a98e227e32f/WebSiteMostViewedItems.ascx:line 62
35.       at ASP.sfctrlpresentation__sfct__369ab264bf820e8e1dd80eea75df7a98e227e32f_websitemostvieweditems_ascx.__BuildControlpnlWebSiteMostViewed() in http://server/SfCtrlPresentation/_SFCT_/369ab264bf820e8e1dd80eea75df7a98e227e32f/WebSiteMostViewedItems.ascx:line 4
36.       at ASP.sfctrlpresentation__sfct__369ab264bf820e8e1dd80eea75df7a98e227e32f_websitemostvieweditems_ascx.__BuildControlTree(sfctrlpresentation__sfct__369ab264bf820e8e1dd80eea75df7a98e227e32f_websitemostvieweditems_ascx __ctrl) in http://server/SfCtrlPresentation/_SFCT_/369ab264bf820e8e1dd80eea75df7a98e227e32f/WebSiteMostViewedItems.ascx:line 1
37.       at ASP.sfctrlpresentation__sfct__369ab264bf820e8e1dd80eea75df7a98e227e32f_websitemostvieweditems_ascx.FrameworkInitialize() in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\9d429797\1f1f0430\App_Web_websitemostvieweditems.ascx.915c3552.tl0fop92.0.cs:line 0
38.       at System.Web.UI.UserControl.InitializeAsUserControlInternal()
39.       at System.Web.UI.UserControl.InitializeAsUserControl(Page page)
40.       at Telerik.Sitefinity.Web.UI.ControlUtilities.LoadControl(String virtualPath, Page page)
41.       at Telerik.Sitefinity.Web.UI.VirtualPathTemplate.GetInstance(Page page)
42.       at Telerik.Sitefinity.Web.UI.VirtualPathTemplate.InstantiateIn(Control container, PlaceHoldersCollection placeHolders)
43.       at Telerik.Sitefinity.Web.UI.VirtualPathTemplate.InstantiateIn(Control container)
44.       at Telerik.Sitefinity.Web.UI.SimpleView.CreateContainer(ITemplate template)
45.       at Telerik.Sitefinity.Web.UI.SimpleView.get_Container()
46.       at Premier.SmarterCommerceModule.Web.UI.Public.WebSiteMostViewedItems.get_PagerControl() in C:\SmarterCommerceSVN\4x\4.0.0.0\Trunk\Applications\SmarterCMS\SmarterCommerceModule\Web\UI\Public\WebSiteMostViewedItems.cs:line 30
47.       at Premier.SmarterCommerceModule.Web.UI.Public.WebSiteMostViewedItems.get_PageIndex() in C:\SmarterCommerceSVN\4x\4.0.0.0\Trunk\Applications\SmarterCMS\SmarterCommerceModule\Web\UI\Public\WebSiteMostViewedItems.cs:line 50
48.       at Premier.SmarterCommerceModule.Web.UI.Presenters.WebSiteMostViewedItemsPresenter.LoadViewFromModel() in C:\SmarterCommerceSVN\4x\4.0.0.0\Trunk\Applications\SmarterCMS\SmarterCommerceModule\Web\UI\Presenters\WebSiteMostViewedItemsPresenter.cs:line 33
49.       at Premier.SmarterCommerceModule.Web.UI.Public.WebSiteMostViewedItems.OnLoad(EventArgs e) in C:\SmarterCommerceSVN\4x\4.0.0.0\Trunk\Applications\SmarterCMS\SmarterCommerceModule\Web\UI\Public\WebSiteMostViewedItems.cs:line 106
50.       at System.Web.UI.Control.LoadRecursive()
51.       at System.Web.UI.Control.LoadRecursive()
52.       at System.Web.UI.Control.LoadRecursive()
53.       at System.Web.UI.Control.LoadRecursive()
54.       at System.Web.UI.Control.LoadRecursive()
55.       at System.Web.UI.Control.LoadRecursive()
56.       at System.Web.UI.Control.LoadRecursive()
57.       at System.Web.UI.Control.LoadRecursive()
58.       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
59.  InnerException:

Thanks in advance for your time and help..

Posted by Community Admin on 24-Jan-2012 00:00


Basically can a Custom Control contain a Custom Control ?

Need to do something different to register the second control ?
What I'm missing here... Virtual Paths maybe ?

In the Visual Studio Designer If I drop one of my custom control on another I receive the following error..

Error Rendering Control - Logout1An unhandled exception has occurred.
Resolution of the dependency failed, type = "Telerik.Sitefinity.Configuration.ConfigManager", name = "XmlConfigProvider". Exception occurred while: Calling constructor Telerik.Sitefinity.Configuration.ConfigManager(System.String providerName). Exception is: ArgumentNullException - Value cannot be null. Parameter name: path1 ----------------------------------------------- At the time of the exception, the container was: Resolving Telerik.Sitefinity.Configuration.ConfigManager,XmlConfigProvider Calling constructor Telerik.Sitefinity.Configuration.ConfigManager(System.String providerName)

Can someone point me in the right direction.. Please..

Posted by Community Admin on 24-Jan-2012 00:00


Ok forget about the VS error because anyway I found that "Templated ASP.NET user controls are not supported in the Visual Studio designer."...

But they should work in run time.. and my SimpleView Controls fails to properly set or get info from child SimpleView controls.

This thread is closed