Monday, December 13, 2010

CSL (Comma Separated List)

A little SQL trick:

-- Recordset a CSL
select REPLACE(REPLACE(REPLACE((SELECT rtrim(CityID) as AFROM BaseCityORDER BY CityIDFOR xml PATH ('')),'</A><A>',','),'</A>',''),'<A>','')

 -- CSL a Recordset

declare @list varchar(1000)
set @list = 'Juan,Pedro,Alberto'
declare @x xml
set
@x = '<A>' + REPLACE(@list,',','</A><A>') + '</A>'

select x.item.value('.','varchar(20)') as nombre
from @x.nodes('//A') as x(item)

Table and Field Names

Don’t hardcode you table or field names.
Use something like; AttributeGroupMapRecord.TableUtils.TableDefinition.TableAliasName + "." + AttributeGroupMapTable. agm_AttributeGroup_ID.InternalName or just AttributeGroupMapTable. agm_AttributeGroup_ID.InternalName.

In the SP the table alias is most likely AttributeGroupMap_
filter.AddFilter(new BaseClasses.Data.SqlFilter(AttributeGroupMapRecord.TableUtils.TableDefinition.TableAliasName + "." + AttributeGroupMapTable. agm_AttributeGroup_ID.InternalName + " = " + AttributeGroupID.ToString()));

http://sjc.ironspeed.com/post/show_single_post?pid=1266475843&postcount=3

Thursday, December 9, 2010

Labels from Resource File

In the database TAB enter this:

<%# GetResourceValue("Label:FieldName") %>


In the Resource file add the corresponding entry:


<data name="Label:FieldName">
   <value>País
</data>

Wednesday, November 10, 2010

Styles

Even when the Style.css clearly says "This file will never be overwritten.", it WILL be overwritten when changing application Theme.

UPDATE: As Style.css is inside theme's folder, and folder is deleted and recreated when theme change, it gets deleted on theme changing. Always make a backup copy of it in application's root folder.

Tuesday, November 9, 2010

Date & Number Format (Culture Info)

1-In .\App_Code\Shared\BaseApplicationPage.cs

protected override void InitializeCulture()
{
string selectedLanguage = (string)Session["AppCultureUI"];

if (!string.IsNullOrEmpty(selectedLanguage))
{

System.Threading.Thread.CurrentThread.CurrentCulture =
System.Globalization.CultureInfo.CreateSpecificCulture(selectedLanguage);
System.Threading.Thread.CurrentThread.CurrentUICulture =
new System.Globalization.CultureInfo(selectedLanguage);
}
base.InitializeCulture();
}


2-In ApplicationWebForm.js

circa line 3487

else
{
// if date formatter not disabled.

remove comments on "else" bloc.