I am trying to build an application where a user chooses a product in the middle content area and then the product attributes will show up on the right side bar. I would like to have this done inside an update panel so that there is no postback. Is there anyway to make two different conlib user controls share data together on one page?
Thanks,
Bryan
Passing Data between 2 ConLib user controls
- BryanWarmoth
- Lieutenant, Jr. Grade (LT JG)
- Posts: 44
- Joined: Fri May 23, 2008 11:24 am
- Location: Puyallup, Wa
- Contact:
Re: Passing Data between 2 ConLib user controls
Technically there will still be a postback, it's how the postback code is generated on the client side that changes when you use an update panel.
I pass values between controls using .Net session variables.
I pass values between controls using .Net session variables.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
- BryanWarmoth
- Lieutenant, Jr. Grade (LT JG)
- Posts: 44
- Joined: Fri May 23, 2008 11:24 am
- Location: Puyallup, Wa
- Contact:
Re: Passing Data between 2 ConLib user controls
Thanks, I got it working using session variables but i am still having some problems with the ajax populating the information section. I can't seem to use an update panel because the 2 controls are in separate parts. My area where you choose the product is in the middle content part and the info should show up in the right sidebar. Any suggestions?
Re: Passing Data between 2 ConLib user controls
Perhaps this code snippet from my BuyProductDialog user control will lead you down the correct path. The trick is using an Able utility function to search the entire page for a particular control. Then you can direct-cast that reference into a new control and access the properties/methods of the original rendered control. You have no idea how long it took me to get working......BryanWarmoth wrote:Thanks, I got it working using session variables but i am still having some problems with the ajax populating the information section. I can't seem to use an update panel because the 2 controls are in separate parts. My area where you choose the product is in the middle content part and the info should show up in the right sidebar. Any suggestions?

Code: Select all
PlaceHolder phProductImage = (PlaceHolder)PageHelper.RecursiveFindControl(this.Parent, "phProductImage");
UpdatePanel AJImagePanel = (UpdatePanel)PageHelper.RecursiveFindControl(this.Parent, "ImageAjax");
string _ImageURL = _OptionChoice.ImageUrl;
string _ImageAltText = _Product.ImageAltText + " (" + _OptionChoice.Name + ")";
if (!string.IsNullOrEmpty(_OptionChoice.ImageUrl))
{
phProductImage.Controls.Clear();
phProductImage.Controls.Add(new LiteralControl("<img id=\"ProductImage\" src=\"" + Page.ResolveClientUrl(_ImageURL) + "\" border=\"0\" alt=\"" + Server.HtmlEncode(_ImageAltText) + "\" />"));
AJImagePanel.Update();
}
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
- BryanWarmoth
- Lieutenant, Jr. Grade (LT JG)
- Posts: 44
- Joined: Fri May 23, 2008 11:24 am
- Location: Puyallup, Wa
- Contact:
Re: Passing Data between 2 ConLib user controls
Finally! Thank you so much that worked perfectly!
Re: Passing Data between 2 ConLib user controls
Fantastic 

Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com