Page 1 of 1

Hiding a template item

Posted: Thu Apr 02, 2009 7:23 am
by cgreathouse
Hello

I'm trying to figure out how to hide a text box from a product template. Here's where I'm at so far...

In BuildProductChoices I monitor the controls being added until I see the RadioButtonList I'm interested in. I then add an event handler like this

((RadioButtonList)o).AutoPostBack = true;
((RadioButtonList)o).SelectedIndexChanged += new EventHandler(ProductHelper_SelectedIndexChanged);

I then added the handler

static void ProductHelper_SelectedIndexChanged(object sender, EventArgs e){}

so now I can see the handle is getting called but I don't know how to tell which are the text boxes I want to hide. I'm able to get the InputFieldId from ac_InputFields. But now I'm stuck

How can I find the control I need hide based on InputFieldId?

Thanks!

Re: Hiding a template item

Posted: Thu Apr 02, 2009 7:29 am
by mazhar
One solution could be to create two CSS classes one for hide/show purpose and then use PageHelper.RecursiveFindControl method to find desired text box and finally change its class to show/hide it.

Re: Hiding a template item

Posted: Thu Apr 02, 2009 7:40 am
by cgreathouse
Thanks!

That's getting me closer. How can I find the control when all I have is the InputFieldId? I don't have the controlId to search on. What I really have is a RadioButtonList. Depending on what radio item is selected, text boxes need to be hidden or made visible.

I have the InputFieldIds, I just need to find the text boxes that are associated with those InputFieldIds.

I feel like I'm so close, just need a little more help.

Thanks!