i have a customized grid view. it has a property "Theme". this property has some item (enum) that change apperacne of my gridview such as hedar background image,rowstyle,rowcolor,etc... . this property work fine.but i must add a folder (contained image) to show background image of header. i must prepare this folder for users (that use my gridview in their website) . i want just users(programmers) add my dll(gridview) and change theme of my grid without any additional work. if you see in my code i must add backgroundimage style refrencde by a floder in web site(ThemeResource/HeaderSoftGamer.png).and naturally users(programmers) must copy this folder of page that use my gridview
public class MTGridView : GridView
{
public enum ThemeCollection { HardBlue, Black, Girly , Sky , Samta };
private ThemeCollection currentTheme;
public ThemeCollection Theme
{
get
{
return currentTheme;
}
set
{
currentTheme = value;
}
}
public MTGridView()
{
this.RowCreated += new GridViewRowEventHandler(MTGridView_RowCreated);
}
void MTGridView_RowCreated(object sender, GridViewRowEventArgs e)
{
switch (Theme)
{
case ThemeCollection.Sky:
{
switch (e.Row.RowType)
{
case DataControlRowType.Header:
e.Row.Style.Add("background-color", "blue");
e.Row.Style.Add("font-family", "Tahoma");
e开发者_开发知识库.Row.Style.Add("font-size", hs.ToString());
e.Row.Style.Add("color", "Black");
e.Row.Style.Add("background-image", "url(ThemeResource/HeaderSoftGamer.png)");
break;
}
}
}
}}
thank all
You can either keep your images on your server and use them from your code or give the complete image folder and ask them to include it with their project. I don't see a workaround for this..
精彩评论