Search This Blog

Loading...
Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

Thursday, April 17, 2008

DefaultButton for ImageButton not working in firefox

Well, read this article first before finding other solution http://support.microsoft.com/kb/921277

I've been trying to look around and work on the code but it's not working. Don't waste your time for simple problem unless you have plenty of them.

The easiest way is change the ImageButton control to Button control as stated in the article. Put in some css will give the same effect/result in term of display like in ImageButton.

Below is the css that i use for this purposes.

.buttoncss
{
width:98px;
height:43px;
background-color:#FFFFFF;
background-image:url(http://xincrm.com/img/Button.gif);
border-style:none;
cursor:pointer;
}

Try this http://www.pagetutor.com/button_designer/index.html if you want to customize your button css. Very useful for me.

Remember set UseSubmitBehavior for Button control to False in Properties window.

UseSubmitBehavior="False"


it's work for me. My problem solved.

Thursday, November 1, 2007

Dynamic CSS reference in ASP.NET

This sample allowed me to dynamic add CSS link to my ASP.NET page. If css provided via querystring, the page will link to provided css. If not provided then if will refer to the default css.


protected void Page_Load(object sender, EventArgs e)
{
string mycss;

if (Request.QueryString["mycss"] != null)
{
if (Request.QueryString["mycss"].ToString().Trim().Length > 0)
{
mycss= Request.QueryString["mycss"].ToString().Trim();
}
else
{
mycss= "~/default.css";
}
}
else
{
mycss= "~/default.css";
}
AddLinkedStyleSheet(this, mycss);
}

public static void AddLinkedStyleSheet(Page page, string stylesheet)
{
HtmlLink link = new HtmlLink();
link.Href = page.ResolveUrl(stylesheet);
link.Attributes["text"] = "text/css";
link.Attributes["rel"] = "stylesheet";
page.Header.Controls.Add(link);
}

credit give to
Rich Sturim