<igmisc:WebPageStyler ID="Green_Gel_Css" runat="server" EnableAppStyling="True" StyleSetName="GreenGel" />
So right now i have a webgrid in the an asp.net page which is link to the master page. I wish to the GreenGel for the style but i not wish to use the property StyleSetName in the webgird. I was wondering how to do call the WebPageStyler from the master page to use it so that when i change my master page style the webgrid can be affected.
Please advise, Thanks for the help
I did not have to add the StyleSetName property to my UltraWebGrid 3.5 in order for it to work.
Here's what I did:
Master Page
1. Create a master page.2. Above the ContentPlaceHolder add the WebPageStyler.3. In the properties of the WebPageStyler click the dropdown next to StyleSetName.4. Import in all the styles.5. Choose the first one.6. Set EnableAppStyling="True".7. Below the WebPageStyler add a dropdown.
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem>Appletini</asp:ListItem> <asp:ListItem>Caribbean</asp:ListItem> <asp:ListItem>Claymation</asp:ListItem> <asp:ListItem>Default</asp:ListItem> <asp:ListItem>ElectricBlue</asp:ListItem> <asp:ListItem>Harvest</asp:ListItem> <asp:ListItem>LucidDream</asp:ListItem> <asp:ListItem>Nautilus</asp:ListItem> <asp:ListItem>Office2007Black</asp:ListItem> <asp:ListItem>Office2007Blue</asp:ListItem> <asp:ListItem>Office2007Silver</asp:ListItem> <asp:ListItem>Pear</asp:ListItem> <asp:ListItem>RedPlanet</asp:ListItem> <asp:ListItem>RubberBlack</asp:ListItem> <asp:ListItem>Trendy</asp:ListItem></asp:DropDownList>
8. Wire up the SelectedIndexChanged event for the DropDownList.
protected void DropDownList1_SelectedIndexChanged( object sender, EventArgs e ){ WebPageStyler1.StyleSetName = DropDownList1.SelectedValue;}
Content Page
9. Add a content page that uses the master page you created.10. Drop a SqlDataSource pointing to a database table.11. Drop an UltraWebGrid on to the page. 12. Set the DataSourceID to the SqlDataSource and accept all the default settings.
As you change the selected index of the dropdown in the master page, the datagrid in the content page will be re-styled without setting the StyleSetName property.
This is a fun way to see what all the different stylesets look like when applied to an UltraWebGrid.
Later, I added other controls to the page, but I found out that I had to explicitly add the StyleSetName to some of them.
Of the controls I tested, these needed the StyleSetName property:
These didn't:
I'm curious, why do some controls require setting the StyleSetName, while others do not?
Also, what is wrong with me that I think applying stylesets to UltraWebGrids is fun?