change the $ sign to thai bhat in catalook in dnn - asp.net

there is a default Dollar Sign before the every Price tag. i want to change this to Thai Bhat of thailand. How can i do it?

Assuming your prices are contained within a span or a div elements using a class such as:
<span class="pricetag">$100,00.00</span>
A simple fix is to use jQuery to replace $ sign with thai baht symbol.
$('.pricetag').text().replace('$', '฿');

I don't know how you are displaying the value you can achieve it by
NumberFormatInfo numinfo = CultureInfo.CreateSpecificCulture("th-TH").NumberFormat;
textbox.Text = yourvalue.ToString("c",numinfo);
All you need to do is refer the Thai culture when considering the value of Price.

Related

how to capitalize the grid headings in web2py

I want the headings of my GRID should be in capital letters.
If I am using
headers='fieldname:capitalize',
as one of the argument in grid its not working.
Please need expert opinion.
Thanks in advance!
The 'fieldname:capitalize' notation works only with SQLTABLE, not SQLFORM.grid. Also, that simply capitalizes the first letter of the field name, not all the letters. If you want all caps headers in the grid, you could do something like:
grid = SQLFORM.grid(db.mytable,
headers={str(f):f.name.upper() for f in db.mytable})
Note, if you don't provide a headers argument, the grid simply uses the .label attribute of each field in the header, so you can also define the .label attributes in all caps. To do that automatically, you could do:
for field in db.mytable:
field.label = field.name.upper()

gridview dataformatstring custom currency

IS there any way, using the dataformatstring, to move the Euro (€) currency symbol to the beggining of the value without hardcoding the euro symbol in the xml?
Example : Using {0:C} I get 1234€ and what i want is to get €1234 . I can't find a solution for this without having to hardcode de euro symbol like €{0:g} .
Any clue ?
Regards
You need to set the CurrencyPositivePattern to 0:
NumberFormatInfo nfi = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();
nfi.CurrencyPositivePattern = 0;
You will likely want to set the CurrencyNegativePattern as well. The link provides all of the patterns.
It would seem safest to specify the default currency symbol.
As whatever your defualt culture is (e.g in case of French Currrency there is a dual currency either it can be the local currency or euros)
NumberFormatInfo numberFormatInfo= (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();
numberFormatInfo.CurrencySymbol = "€";

Text box validation using regular expression

I have a textbox and have to use the regular expressions in asp.net
My text should not allow the spaces in first and last place. In between words it can allow.
that means: it should allow alphabets, numbers and all special characters.
Output should be:
India Bangalore -valid
India Bangalore - not valid
!India bangalore - valid
India bangalore!##$%- valid
IndiaBangalore - valid
i.e : use can enter the spaces in between the words but not in first position and last position.
Java script also fine.
Thanks in advance.
Here is a quick example
// Input string
string st = " This is an example string. ";
// Call Trim instance method.
// This returns a new string copy.
st = st.Trim();
U can get the index, i mean index(0) is the first position of textbox and calculate the length of ur input +1 = last index of ur input validate white space validation now. damn sure it will work

how to change the FormatCurrency()?

I am using this line :
FormatCurrency(DBReader("Price").ToString, 2, True)
to format my Currency
and I have two websites, the first one is English and the second is Arabic.
In the English website the price will be in $ Currency because the the localization setting is set as "en-US".
In the Arabic website the price will be in ل.ل Currency because the the localization setting is set as "ar-LB".
The question is how to format this code:
FormatCurrency(DBReader("Price").ToString, 2, True)
to make the currency in the $ only in both websites?
Check out the examples here, that use the overloaded toString function coupled with a format specifier and locale.
In your FormatCurrency method make use of NeutralCulture or en-US culture

How to include math Symbols in Editor or Textbox

I have to include math symbols in my asp.net
so whatever the symbols it may be sigma , integral , pie etc..or any
how to write or display the Symbols in asp.net it should be UI so when the user click the
particular Symbols it will display in the textbox or any editor control..
If anyone have idea let me know...?
thanks.
Since you are using ASP.NET you can use the HTML character entity references to display symbols.
http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
Updated
You can just put the special characters into your html code. Prefix the items from the reference with "&#" and suffix with ";"
∫ dy K(x,y)φ(y) = λφ(x)
yields
∫ dy K(x,y)φ(y) = λφ(x)

Resources