Multiple Stylesheets in Themes

Many of you may not know this, but you can have multiple stylesheets within a theme.

Let’s say you have a lot of styles, and you’d like to categorize them in some way – maybe typestyles, layouts or colors. What you can do is have 3 separate stylesheets within one theme, categorized in whichever way you’d like.

But watch out – there’s one ‘gotcha’. The names of the stylesheets be  alphabetical in the filesystem, and therefore, will be addressed sequentially, based on the alphabetical position in the filesystem. So – be careful. If you have one style for TD in a stylesheet in a low alphabetical position, and then you have another style TD style in a higher alphabetical position, the TD style in the higher alphabetical stylesheet will be used, overriding the stylesheet in the lower alphabetical position.

Display Particular Format for Phone Number

Let’s say your database stores phone numbers without the dashes or parentheses, but you would like to display it like that, on the web page.

To do this, store the number as an integer, and then, the following code snippet will do the trick:

Dim s as integer="1234567891"label1.text=string.Format("{0:(000)000-0000}",s)

How to use ASP.Net control in Javascript

Let’s say you have a textbox (ASP.Net control) named:
‘txtFirstName’
To be able to use the ID in your Javascript functions, you can do something like this:
var txtbox = document.getElementById(‘<%=txtFirstName.ClientID%>’);

Then, you can use the variable ‘txtBox’ throughout your Javascript function, with the normal Javascript attributes (txtbox.value, txtbox.disabled, etc)

On Button click check-uncheck all checkboxes

<script language=”javascript” type=”text/javascript”>

function Select(Select)

{
for (var n=0; n < document.forms[0].length; n++)

if (document.forms[0].elements[n].type==”checkbox”)

document.forms[0].elements[n].checked=Select;

 return false;

}

</script>

onClientclick=”javascript:Select(true)”

GroupBox in ASP.Net

To get the same results in ASP.Net as Winforms for a GroupBox (header/group text, along with a rounded-corner border), just use an ASP.Net panel, and use the GroupingText property.

<asp:Panel ID="Panel1" runat="server" GroupingText="My Group"></asp:Panel>