Causing an asp event
Causing an asp event
Hello... I have an interesting problem that hopefully someone could help me out with...
I have a few different conlib pages that are being included on my product page. Here is a picture of what I have going on now... Okay, so as you can see, I have a tabbed description area. Now, I have the tabs setup as Asp:Buttons that call different methods that will hide/show the content of the tabs, and change style of the button/table elements. Now, the problem I am having is this...
I want to turn the ***** Average Customer Rating part on my page into a link that will move the page to the Reviews section (i.e., <a href="#...">) and open the tab (i.e., call the function ChangeReview(sender, even)). So, here is the issue...
I have all of these (as is setup standard in Able) different elements setup in the Show Product Custom.htm page as Conlib elements. So, essentially, my page there ends up looking like:
[[Conlib:ProductImages]]
[[Conlib:CustomProductSwatches]]
[[Conlib:BuyProductDialogueCustom]]
[[Conlib:ProductDescriptionCustom]]
etc..., and of course, all laid out in tables or whatever. Where I am having a problem, is trying to call a method that is attached to the "Reviews" asp button, which is included in the ProductDescriptionCustom conlib from a link included on the BuyProductDialogueCustom conlib.
Is this possible? I'm sure anything is possible, but, for the life of me, I can't seem to figure this out.... The only way I could think of was actually linking to a new page that includes a ?Tab=Review kind of thing, and having my ProductDescriptionCustom conlib build initially with the reviews opened. Not ideal, since I would have to reload the whole page.
I am definitely a novice asp .net programmer, so anyone that could save me of bunch of trial and error would be GREATLY appreciated.
I just wanted to say too, that as a new user to Able Commerce, I definitely have appreciated all of the incredible support of this community.
Thank you all.
Scott
I have a few different conlib pages that are being included on my product page. Here is a picture of what I have going on now... Okay, so as you can see, I have a tabbed description area. Now, I have the tabs setup as Asp:Buttons that call different methods that will hide/show the content of the tabs, and change style of the button/table elements. Now, the problem I am having is this...
I want to turn the ***** Average Customer Rating part on my page into a link that will move the page to the Reviews section (i.e., <a href="#...">) and open the tab (i.e., call the function ChangeReview(sender, even)). So, here is the issue...
I have all of these (as is setup standard in Able) different elements setup in the Show Product Custom.htm page as Conlib elements. So, essentially, my page there ends up looking like:
[[Conlib:ProductImages]]
[[Conlib:CustomProductSwatches]]
[[Conlib:BuyProductDialogueCustom]]
[[Conlib:ProductDescriptionCustom]]
etc..., and of course, all laid out in tables or whatever. Where I am having a problem, is trying to call a method that is attached to the "Reviews" asp button, which is included in the ProductDescriptionCustom conlib from a link included on the BuyProductDialogueCustom conlib.
Is this possible? I'm sure anything is possible, but, for the life of me, I can't seem to figure this out.... The only way I could think of was actually linking to a new page that includes a ?Tab=Review kind of thing, and having my ProductDescriptionCustom conlib build initially with the reviews opened. Not ideal, since I would have to reload the whole page.
I am definitely a novice asp .net programmer, so anyone that could save me of bunch of trial and error would be GREATLY appreciated.
I just wanted to say too, that as a new user to Able Commerce, I definitely have appreciated all of the incredible support of this community.
Thank you all.
Scott
Re: Causing an asp event
How come you're not using the tabbed menu control provided with AC7?
With it you could just .Visible="False" the appropriate tabs on the buyproductdialog pre_render() function.
If you're set on calling a method that is part of a web control on the page, use the Able RecursiveFindControl to locate it and direct-cast a new reference. Then you can call the method directly from your code.
But it sounds like your original tab design is working against you...bone up on the tabbed control. That's what I'm using on my site and it's very robust.
With it you could just .Visible="False" the appropriate tabs on the buyproductdialog pre_render() function.
If you're set on calling a method that is part of a web control on the page, use the Able RecursiveFindControl to locate it and direct-cast a new reference. Then you can call the method directly from your code.
But it sounds like your original tab design is working against you...bone up on the tabbed control. That's what I'm using on my site and it's very robust.
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
Re: Causing an asp event
Hey Joe, thanks for the great info, as always!
Quick question, though... Is there some kind of resource available to let me know what type of things, like this, are included with Able? Since I am so new to this platform, a lot of times I have no idea the best way to accomplish things. Knowing what is already included would certainly help! The tabs did only take about a couple of hours to finish, but, as you say... looks like my design is working against me now!
Thanks again for the help!
Scott
Quick question, though... Is there some kind of resource available to let me know what type of things, like this, are included with Able? Since I am so new to this platform, a lot of times I have no idea the best way to accomplish things. Knowing what is already included would certainly help! The tabs did only take about a couple of hours to finish, but, as you say... looks like my design is working against me now!
Thanks again for the help!
Scott
Re: Causing an asp event
just to clarify.... Are you talking about the ajax:TabPanel??
Thanks Joe!
Scott
Thanks Joe!
Scott
Re: Causing an asp event
Nope.heinscott wrote:just to clarify.... Are you talking about the ajax:TabPanel??
There is an excellent 3rd-party menu control that is included with AC7 from ComponentArt.com - one of those little undocumented gems with about 1 billion features to enjoy called the Web.UI control. Their online documentation can be found at http://www.componentart.com/docs/. I don't think the version included with AC7 is the 2008.1 version, but much of the documentation is the same.
Their tab menu was a little tricky to wrap my head around at first, but once I got the hang of it, I found it quite easy. The user control I sell "ProductDescriptionTabbed" is a drop-in-and-use version of the AC7 ProductDescription.ascx control modified to use their tab menu control.
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
Re: Causing an asp event
Thanks again, Joe. One last thing... The recursiveFindControl method... Could you give me an example? For instance, I have my button called "ReviewsButton" that when clicked, calls the ChangeReviews method. I tried to create a new instance,
WebControl reviewPanel = (WebControl)PageHelper.RecursiveFindControl(this, "ButtonReviews");
from the method I want to use when a link is clicked. I am unsure, however, how to proceed from this point.
Could you, perhaps, give me a quick walk-through?
Thanks a lot. Your help is much appreciated!
Scott
WebControl reviewPanel = (WebControl)PageHelper.RecursiveFindControl(this, "ButtonReviews");
from the method I want to use when a link is clicked. I am unsure, however, how to proceed from this point.
Could you, perhaps, give me a quick walk-through?
Thanks a lot. Your help is much appreciated!
Scott
Re: Causing an asp event
You have to cast the findcontrol into the type of control that you want to manipulate.
For example:
...would search the current web page for a control with an ID value of "Tabstrip1". If it's found, it will return a variable called "PDTabStrip" that has been cast into the object type of "TabStrip". You can do this with any web control type like dropdownlist, textbox etc.
Then you could do things like:
In other words, you're making a pointer to the actual web control without having created the web control in the code that is currently executing. Most of the time, you can only reference a control if you've created that control in the code that's currently running. Doing it this way lets you snag a reference to an existing control, even if it's created somewhere else by another user control, etc.
Once you've snagged a reference to it, all the methods and properties will be available in code just as if you'd created that control in the code you are executing at the time.
For example:
Code: Select all
TabStrip PDTabStrip = (TabStrip)PageHelper.RecursiveFindControl(this.Parent, "Tabstrip1");
Then you could do things like:
Code: Select all
PDTabStrip.Visible = false;
Once you've snagged a reference to it, all the methods and properties will be available in code just as if you'd created that control in the code you are executing at the time.
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
Re: Causing an asp event
Thanks Joe! That is what I needed...
I'm going to play around with that Component Art menu, too... Hopefully it will simply the entire process.
Thanks for being helpful as always!
Scott
I'm going to play around with that Component Art menu, too... Hopefully it will simply the entire process.
Thanks for being helpful as always!
Scott
Re: Causing an asp event
Hey Joe... I took your advice and swtiched my menu over to a ComponentArt:TabStrip... Okay, the menu looks great, and functions very quickly.
Now, the problem I am having is this... The PageHelper.RecursiveFindControl method does not seem to work for ComponentArt controls. How, then, do you think I should go about having my link trigger a particular tab to open?
Any help would be appreciated!
Scott
Now, the problem I am having is this... The PageHelper.RecursiveFindControl method does not seem to work for ComponentArt controls. How, then, do you think I should go about having my link trigger a particular tab to open?
Any help would be appreciated!
Scott
Re: Causing an asp event
It works - I'm using it now. The recursivefindcontrol will find any control - it doesn't care who wrote it. Note from the examples I posted earlier that actually involve their tabstrip control.heinscott wrote:Now, the problem I am having is this... The PageHelper.RecursiveFindControl method does not seem to work for ComponentArt controls. How, then, do you think I should go about having my link trigger a particular tab to open?
Any help would be appreciated!
There are couple of reasons the control isn't found. The first being the possibility it doesn't exist yet in the page. Any attempt to find a control is dependent on where in the hiearchy of page construction code you are trying to find the control. For instance, if you try it Page_Init(), it'll never find it because .Net hasn't even begun to build the page so no controls exist yet. But if you try it Page_PreRender(), all controls are built. There is a very specific sequence of events in terms of how .Net constructs a page. If you are testing for the control in a section of code where the control may not yet exist, it won't be found.
The other reason is you must match the ID value you set in the HTML side.
Maybe this snippet from BuyProductDialog.Page_PreRender() will give you a direction to travel:
Code: Select all
UpdatePanel AJDescPanel = (UpdatePanel)PageHelper.RecursiveFindControl(this.Parent, "DescriptionAjax");
MultiPage PDTabStripPage = (MultiPage)PageHelper.RecursiveFindControl(this.Parent, "MultiPage1");
TabStrip PDTabStrip = (TabStrip)PageHelper.RecursiveFindControl(this.Parent, "Tabstrip1");
PDTabStrip.SelectedTab = PDTabStrip.Tabs[0];
AJDescPanel.Update();
So your productdescription.ascx file should have something like this:
Code: Select all
<ajax:UpdatePanel ID="DescriptionAjax" UpdateMode="Conditional" runat="server">

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
Re: Causing an asp event
Joe, I know you've probably heard this before... but, you rock!
Thanks again. And again, I've learned something useful!
All the best,
Scott
Thanks again. And again, I've learned something useful!
All the best,
Scott