Display row count in GridView
ASP.NET Gridview is kinda complicate to handle sometimes. First time, I didn’t know how to display row count in Gridview. Whatever I tried is displaying vistual ID of database. After that, I found how to display row count in Gridview.
<asp:TemplateField>
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
</asp:TemplateField>
SES for Coldfusion
Do you wanna do all of your URLs to be familiar to search engine? It’s ok that sesConverter can fulfill your desire. It’s simple to implement and manipulate. First of all, download sesConverter.cfm. Then, you need to include this file into your application.cfm file. After that, move to sub-directory such as news, blogs and so on.
in application.cfm file
<cfset SESdummyExtension = “.cfm”>
<cfset SESrBaseName = “baseHREF”>
<cfinclude template=”sesConverter.cfm”>
In index.cfm file of sub-folder, you need to write like :
<base href=”http://www.mywebsites.com/news/”>
Change like that in all of your href:
http://www.mywebsite.com/news/read.cfm/id/10/category/2
instead of
http://www.mywebsite.com/news/read.cfm?id=10&category=2
Write text vertically with CSS
Write text vertically with CSS is kinda simple. But, it works only in IE.
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<title>Write Text Vertically</title>
</head><body>
<style>
<!–
.verticaltext {
writing-mode: tb-rl;
filter: flipv fliph;
font-family: tahoma, verdana;
background:#f0f0f0;
padding:5px;
width: 30px;
}
–>
</style><div>Test-1</div>
</body>
</html>
CFEclipes for CFML deverloper
In these days, I’m getting sick of developing CFML pages with homesite5. Because, it doesn’t support for cfmx8 tag and sometimes, getting errors and got off. On the other hand, I don’t want to install DreamWeaver because it’s kinda big and take much of space and memory. That’s why I was dilemma between them. So, I was surfing through websites and solving this problems. Finally, I got it eclipse is suitable for CFML developer.
Download Eclipse Here http://www.eclipse.org/downloads
Then follow up this instruction; how to install cfeclipse plug-in in eclipe http://www.dopefly.com/projects/cfeclipse.cfm?CFID=2953264&CFTOKEN=29845399#a1
Toggle Slide with jQuery
I’m now running on pre-sales Project. My job is to beautify existing codes and to change old-fashioned code to latest technology. A part of this project, my boss told me to integrate two slides into main frame with toggle features. I feel that I can do it with jQuery. That’s why I was working on this portion for 3 hours. Finally, I found useful code in french blog of le informaticien français.
But, I need to hack some coding of his javascript file to reuse into my project.
Merci à vous, Julien Chauvin.
Best Credit : http://www.webinventif.fr/wslide-plugin
Internationalized in CFMX with Cffunction
It’s, creating internationalize in CFMX with cffunction.
common.cfm
<cffunction name=”udf_Translate” output=”Yes” returntype=”string” hint=”reads and parses UTF-8 resource bundle per locale”>
<cfargument name=”Name” required=”Yes” type=”string”>
<cfargument name=”Filename” required=”Yes” type=”string”>
<cfargument name=”Section” required=”No” type=”string”>
<cfset currentPath = getCurrentTemplatePath()>
<cfset currentDirectory = getDirectoryFromPath(currentPath)>
<cfset local_file = currentDirectory & Filename>
<cfset flag = 0>
<cfset i = 0>
<cfif FileExists(local_file)>
<cffile action=”read” file=”#local_file#” variable=”resourceBundleFile” charset=”utf-8″>
<cfset Transalated = ArrayNew(2)>
<cfloop index=”rbIndx” list=”#resourceBundleFile#” delimiters=”#chr(10)#”>
<cfset i = i + 1>
<cfset Orginal_word = listFirst(rbIndx,”=”)>
<cfset Transalted_word = listRest(rbIndx,”=”)>
<cfset Transalated[i][1] = Orginal_word>
<cfset Transalated[i][2] = Transalted_word>
<cfif ASC(Transalted_word) NEQ 13><cfset Transalated[i][2] = Transalted_word><cfelse><cfset Transalated[i][2] = Transalated[i][1]></cfif>
<cfif Transalated[i][1] EQ Name>
<cfset flag = 1>
<cfreturn Transalated[i][2]>
</cfif>
</cfloop>
</cfif>
<cfif flag EQ 0><cfreturn Name></cfif>
</cffunction>
index.cfm
<cfoutput>#udf_Translate(“Sex”, “INPATIENT_EL.properties”, “”)#</cfoutput>
Set radio value to parent form
Here is setting radio value from pop-up form to parent form.
<form name=”myform”>
<input type=”Radio” name=”myradio” value=”1″> 1<br>
<input type=”Radio” name=”myradio” value=”2″> 2<br>
<input type=”Radio” name=”myradio” value=”3″> 1<br>
<input type=”Button” name=”btnSelect” value=”Select” onclick=”getCheckedValue(document.forms['myform'].elements['myradio'])”>
</form><script>
<!–
function getCheckedValue(radioObj) {
if(!radioObj)
return “”;
var radioLength = radioObj.length;
if(radioLength == undefined)
if(radioObj.checked)
window.opener.document.parent_form.txtRemark.value = radioObj.value;
else
return “”;
for(var i = 0; i < radioLength; i++) {
if(radioObj[i].checked) {
window.opener.document.parent_form.txtRemark.value = radioObj[i].value;
}
}
window.close();
return “”;
}
–>
</script>
Internationalized in CFMX
Folks,.. As you know, getprofilestring doesn’t support unicode format. That’s why we don’t have to create our projects for multi-language. Because, I’m doing project for Vietnamese, which is unicode format. That’s why I need to solve this problem. I stuck on this solution for 5 hours. Finally, I gotcha..!!
You can use my coding, but please don’t forget to credit to me.
udf_Translate.cfm
<cfscript>
function udf_Translate(Name, Filename) {
infile = FileOpen(Filename, “read”, “UTF-8″);
i = 0;
flag = 0;
while (! FileIsEOF(infile)) {
i++;
x = FileReadLine(infile);
Org = trim(listFirst(x,”=”));
Lang = trim(listRest(x,”=”));
MyArray.array[i][1] = Org;
MyArray.array[i][2] = Lang;
if (MyArray.array[i][1] == Name)
{
WriteOutput(MyArray.array[i][2]);
flag = 1;
}
}
if (flag == 0) WriteOutput(Name);
FileClose(infile);
MyArray = StructNew();
MyArray.array = ArrayNew(2);
}
</cfscript>
Client.cfm
<cfoutput>#udf_translate(“User Name”, “Filename = “D:\PPSHEIN\PP\Test\GREEK.properties”")#</cfoutput>
How? It’s easy, isn’t it?
Cftooltip example
I used so many Ajax, javascripts and CSS for doing tooltip when I didn’t know about cftooltip. If cftooltip feature is on CFMX8, we can save our time for doing tooltip. Using cftooltip is kinda simple :
<cftooltip sourceForTooltip=”mybio.cfm”>PPSHEIN</cftooltip>
Rounded Corner for IE
If you want to make rounded corner box for everything, you may use integrating with images and css. Unless, For firefox, you can set border-radius by prefixing “-moz” to the css property. And ofcource for webkit use “-webkit. For IE, border-radius doesn’t work on it. That’s why we need to integrate images and css for doing rounded corner. If you’re sick of doing so, you can use following coding:
The CSS:
.curved {
padding:4px 0px 0px 0px;
width:80px;
height:20px;
border:#666666 solid 1px;
color:#000000;
text-align:center;
-moz-border-radius:20px;
-webkit-border-radius:10px;
behavior:url(border-radius.htc); [it's written by Javascript]
}
The HTML:
<div class=”curved”>rouneded div</div>
Best Credit to :


