I have a dropdown list which contains:
- product a
- product b
- product c
If I have chosen "product a" it should render the corresponding sublayout for product a
Current code:
- I have item called basket
- In the basket item I have added the presentation details of the products(a,b,c)
- In the website I have rendered all the sublayout and hiding the hiding the unwanted sublayout
Pseudo code:
var a = get the dropdown list select item
if(a.Value == "product a")
{
showDivWithPlaceholderOfProductA.Visible = true;
showDivWithPlaceholderOfProductB.Visible = false;
showDivWithPlaceholderOfProductC.Visible = false;
}
else if(a.Value == "product b")
{
showDivWithPlaceholderOfProductB.Visible = true;
showDivWithPlaceholderOfProductC.Visible = false;
showDivWithPlaceholderOfProductA.Visible = false;
}
else
{
showDivWithPlaceholderOfProductC.Visible = true;
showDivWithPlaceholderOfProductA.Visible = false;
showDivWithPlaceholderOfProductB.Visible = false;
}
Drawback of current implementation:
The above code is rendering the all of the sublayouts and then showing / hiding the required sublayout.
How to change it:
1. I need to render only the required sublayout instead of hiding/showing
2. Can any one suggest better idea for rendering the sublayout based on the above scenario?