Page 1 of 1

Get access to Dropdown list generated by options and variant

Posted: Thu Aug 19, 2010 4:49 am
by Dylan
I have created a option “Width” for my product which generates a dropdown list within a PlaceHolder control on the product page. I want to get access to this dropdown list control in BuyProductDialog.ascx.cs how can I do this ?

I want to get the length of the dropdown list and loop round the list of items.

Can I use method PageHelper.RecursiveFindControl(phOptions, what attribute do I need to pass by value here)


Thanks

Dylan

Re: Get access to Dropdown list generated by options and variant

Posted: Thu Aug 19, 2010 5:07 am
by mazhar
Have a look at ProductHelper.BuildProductOptons method. This method is used to generate/populate the product options. Secondly I don't think so RecursiveFindControl could be used here because these controls are dynamic so control id will not be known. You can try to do one trick where when creating these dynamic options in BuildProductOptoins method you can also inject some of your hidden HTML where you can put the corresponding clientid of each dropdown. Then once you can access information about each dropdown list using clientid information and RecursiveFindContorl method.