mjgardne
Registered: 01/22/07
Posts: 120
|
| Posted 08/07/12 at 07:24 PM | Reply with quote #1 |
|
Hello,
In the mobile version of one of our pages, I have create an accordian and it is working great. However, all examples for creating an accordian always use embedded static text for the text that is displayed to the user. I need to pull the text from resources and display that value, from the code behind, to the user for each of the labels in an accordian. Here is one accordianpane that display's "Contact". What do I have to replace "Contact" with in order to be able to change what is displayed at runtime?
Thank you for your help and suggestions!
Mike
<asp:accordionpane id="ContactAccordionPane" runat="server"> <header> <br /><table border="0" cellpadding="0" cellspacing="0" style="width: 100%;"><tr><td class="mobileAccordionHeader"><span class="mobileAccordionHeaderTitle"> Contact</span></td></tr></table> </header> <content> <GEN ANEL NAME="ContactPanel" /> </content> </asp:accordionpane> |
| Loading... | |
miles

MVP Consultant
Registered: 10/15/03
Posts: 3,218
|
| Posted 08/08/12 at 05:30 AM | Reply with quote #2 |
|
Use FindControlRecursively to find the control, and update accordingly. You could probably put this in the PreRender event.
HTH, __________________ Miles Gibson, I.S.P., ITCP
Iron Speed MVP
Senior Consultant, Principal,
Milestone Software
http://www.ironspeedmvp.com
Email: miles@milestone.ca
Coming Soon: Full Localization for your Iron Speed Applications! |
| Loading... | |
mjgardne
Registered: 01/22/07
Posts: 120
|
| Posted 08/08/12 at 01:12 PM | Reply with quote #3 |
|
Hi Miles,
Thank you for your response.
The issue is that the name that is displayed for the AccordianPane is not a part of the control. It is in some HTML code in the AccordianPane where text is displayed. My thought was that I could replace "Contact" with an aspx control like "Literal" and then use FindControlRecursively, but when I tried it, I always received a null. This is why I was asking how others are dealing with it. I'm going to work on this issue more today and will report my solution (hopefully).
Thanks,
Mike |
| Loading... | |
mjgardne
Registered: 01/22/07
Posts: 120
|
| Posted 08/08/12 at 02:38 PM | Reply with quote #4 |
|
Hmmm... That was simple enough... I replaced "Contact" with an ASPX Literal. In the code behind, I did a FindControlRecursively(), and set its value. For some reason, when I tried it last night, I kept getting null, but today it is working. Most likely, fatigue was my enemy last night! Anyway, here is an example that may help others... // ACCORDIAN CELL IN ISD <asp:accordionpane id="ContactAccordionPane" runat="server"> <header> <br /><table border="0" cellpadding="0" cellspacing="0" style="width: 100%;"> <tr> <td class="mobileAccordionHeader"><span class="mobileAccordionHeaderTitle"> <asp:literal id="AccordianContactLiteral" runat="server"></asp:literal></span> </td></tr></table> </header> <content> <GEN ANEL NAME="ContactPanel" /> </content> </asp:accordionpane> // CODE BEHIND Literal literal = BaseClasses.Utils.MiscUtils.FindControlRecursively(this, "AccordianContactLiteral") as Literal; if literal != null) { literal.Text = GetResourceValue("Aboh_Txt_NotifyByEmail", "XXXAppName"); } else { // Failed to find the literal control. throw new NullReferenceException(""); }
// CODE BEHIND
|
| Loading... | |