(If you use Bootstrap...nothing to see here)With more and monitor sizes to deal with there are times when a website will need to load different cascading style sheets. If you have a site that has a fixed grid, for example, and you do not want it to wrap or allow the user to alter the look, you may need to load multiple style sheets.
Here is one method. In the header section of your Master Page load a different style sheet based on monitor resolution.
<script type="text/javascript">
var screenWidth = screen.availWidth;
/*alert(screen.availWidth);*/
if (screenWidth > 1024) {
document.write('<link rel="stylesheet" type="text/css" href="main_highres.css"/>');
}
if (screenWidth <= 1024) {
document.write('<link rel="stylesheet" type="text/css" href="main.css"/>');
}
</script>
You have an ASP.NET ListBox and you want to be able to allow users to Double Click on the list box to select items. You can add a hidden button to your page and then add a double click event to the list box to select items as shown below.
//Setup a string that will call a hidden button click event
string BntListBoxClick = "document.getElementById('"
+ BtnAddToTarget.ClientID.ToString() + "')"
+ ".click();";
//Add the double click event to the list box
LBoxSelectItems.Attributes.Add("OnDblClick", BntListBoxClick);
In ASP.NET you need to call a button click event event from another control, or to take some type of action in the code behind.
The example below adds a double click event to an ASP.NET ListBox and calls a ASP.NET command button.
//Setup a string that will call a button click event
string BntListBoxClick = "document.getElementById('"
+ BtnAddToTarget.ClientID.ToString() + "')"
+ ".click();";
//Add the double click event to the list box
LBoxSelectItems.Attributes.Add("OnDblClick", BntListBoxClick);