Skip to main content

Posts

Showing posts from December, 2009

How to use ListView control in asp.net

ListView Web Server Control ListView is an ASP.NET web server control. ListView allows us to data bind with DataSource and display data. We can show ListView data items on pages. ListView can display data items individually or it can group data items. .NET developers can format data using templates and styles in a ListView control. ListView is popular for displaying data in any repeating structure. It is a similar server control to the DataList and Repeater server control. But ListView has more facilities such as the user can edit, update, insert, delete, sort, and even page data. All those are ListView built-in features, so you don't need to code for any one facility. LisView can data bind with SqlDataSource control using its DataSourceID property. By binding data with data source control we can get its built-in advantage such as paging data, sorting data, inserting, deleting, and editing data. ListView DataSource property allows us...

cfqueryparam- how to use cfqueryparam in cfquery tag

cfqueryparam Usingcfqueryparam.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfqueryparam- how to use cfqueryparam in cfquery tag</title> </head> <body> <h2 style="color:DarkBlue; font-style:italic">ColdFusion cfqueryparam tag example: how to use cfqueryparam</h2> <hr width="600" align="left" color="PowderBlue" /> <br /> <cfparam name="url.BookID" default="0"> <cfquery name="Books" datasource="cfbookclub"> select BookID, Title from Books where BookID = <cfqueryparam value="#url.BookID#" cfsqltype="cf_sql_integer"> </cfquery> <div style="font-family:'Courier New', Courier, monospace; font-size:large;"> <a href=...

How to use cfsqltype in cfqueryparam tag in ColdFusion

CFqueryparam and CFsqltype Usingcfsqltype.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfqueryparam and cfsqltype - how to use cfsqltype in cfqueryparam tag</title> </head> <body> <h2 style="color:DarkBlue; font-style:italic">ColdFusion cfqueryparam tag example: how to use cfsqltype</h2> <hr width="600" align="left" color="PowderBlue" /> <br /> <cfparam name="url.EmpID" default="0"> <cfquery name="qEmploees" datasource="cfdocexamples"> select Emp_ID, FirstName, LastName from Employee where Emp_ID = <cfqueryparam value="#url.EmpID#" cfsqltype="cf_sql_integer"> </cfquery> <div style=" font-family:'Lucida Sans Unicode', 'Lu...

How to cache query data in session scope in ColdFusion

Session scopes query caching - cache query data in session scope QueryCacheSessionScope.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Session scopes query caching - how to cache query data in session scope</title> </head> <body> <h2 style="color:Crimson; font-style:italic">ColdFusion query caching example: how to cache query in session scope</h2> <hr width="600" align="left" color="LightPink" /> <br /> <!--at first enable session management in application.cfm file--> <cfset Session.UserName="cfsuman"> <cfquery name="Session.Authors" datasource="cfbookclub" maxrows="2"> select AuthorID, FirstName, LastName from Authors </cfquery> <cfdump var="#Session#...

How to use NOT EQUAL operator in cfif condition in ColdFusion

Introduction In ColdFusion web development, control flow plays a critical role in dictating the behavior of web applications based on specific conditions. One of the most fundamental ways to manage this control flow is through the cfif tag, which allows for the evaluation of conditions and the execution of corresponding blocks of code. In this tutorial, we explore how to use the "NOT EQUAL" operator within a cfif condition. This operator enables developers to execute different blocks of code when two values do not match, making it an essential tool for implementing conditional logic in ColdFusion applications. This article will break down the example code step-by-step to explain the key elements involved, from defining variables to styling the output. By the end of this guide, you’ll have a better understanding of how the "NOT EQUAL" operator works within ColdFusion’s cfif structure, and how you can apply this in your own web development projects. Variable Declar...

How to use NEQ operator in cfif condition in ColdFusion

CFif NEQ operator cfifNEQOperator.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfif NEQ operator - how to use (NEQ) operator in cfif condition</title> <style type="text/css"> .divCSS { background-color:Crimson; color:White; font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; font-size:large; width:400px; height:60px; text-align:center; padding-top:10px; border:thick; border-style:dotted; } </style> </head> <body> <h2 style="color:SeaGreen; font-style:italic">coldfusion cfif tag example: how to use "NEQ" operator</h2> <hr width="575" align="left" color="LawnGreen" /> <br /> <cfset UserRole="Guest"> <div class="divCSS...

ColdFusion - How to use IS NOT operator in cfif conditional processing

CFif IS NOT operator cfifISNOTOperator.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfif IS NOT operator - how to use (IS NOT) operator in cfif conditional processing</title> <style type="text/css"> .divCSS { background-color:DeepPink; color:Snow; font-family:"Courier New", Courier, monospace; font-size:large; width:450px; height:75px; text-align:center; padding-top:25px; } </style> </head> <body> <h2 style="color:SeaGreen; font-style:italic">coldfusion cfif tag example: how to use "IS NOT" operator</h2> <hr width="550" align="left" color="DarkSeaGreen" /> <br /> <cfset PreferedColor="DodgerBlue"> <div class="divCSS"> ...

How to use variable prefixes in ColdFusion

ColdFusion variable prefixes VariablePrefixes.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>coldfusion variable prefixes - how to use in coldfusion application</title> </head> <body> <h2 style="color:DarkBlue; font-style:italic">coldfusion variable prefixes example: how to use</h2> <hr width="500" align="left" color="LightBlue" /> <br /> <!--enable session management in application.cfm file--> <cfset Variables.MyNumber=2> <cfset Session.MyNumber=5> <cfset Application.MyNumber=10> <cfset Total=MyNumber+MyNumber+MyNumber> <cfset TotalWithPrefixes=Variables.MyNumber+Session.MyNumber+Application.MyNumber> <table border="0" cellpadding="2" cellspacing="2" bgcolor=...

ColdFusion variables typeless feature

ColdFusion Variables are typeless TypelessVariables.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ColdFusion Variables are typeless - how to test variables typeless feature</title> </head> <body> <h2 style="color:SeaGreen; font-style:italic">ColdFusion Variables are typeless example: how to verify</h2> <hr width="600" align="left" color="DarkSeaGreen" /> <br /> <cfset TestNumber=5> <cfset TestString="20"> <cfset SampleMath=TestNumber*TestString> <cfset SampleString="First Number: " & TestNumber & " Second Number: " & TestString> <table border="0" cellpadding="2" cellspacing="2" bgcolor="OrangeRed"> <tr style="b...

ColdFusion number and date format mask

coldfusion functions masks FunctionsMasks.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>coldfusion functions masks - how to use masks in coldfusion functions</title> </head> <body> <h2 style="color:DarkBlue; font-style:italic">coldfusion functions masks example: how to use</h2> <hr width="450" align="left" color="LightBlue" /> <br /> <cfset Salary=1525> <cfset SalaryWithMask=NumberFormat(Salary,"$")> <cfset ToDay=DateFormat(Now())> <cfset ToDayWithMask=DateFormat(Now(),"mmmm-dd-yyyy")> <table border="0" cellpadding="2" cellspacing="2" bgcolor="DeepPink" width="250"> <tr style="background-color:OrangeRed; color:Snow; font-si...

ColdFusion dynamic variables

coldfusion dynamic variables DynamicVariables.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>coldfusion dynamic variables - how to create and use in coldfusion</title> </head> <body> <h2 style="color:DarkBlue; font-style:italic">coldfusion dynamic variables example: how to use</h2> <hr width="500" align="left" color="LightBlue" /> <br /> <cfset ColorName="Crimson"> <cfset "#ColorName#"="Red type color"> <cfdump var="#Variables#"> <br /> <table border="0" cellpadding="2" cellspacing="2" bgcolor="DeepPink" width="250"> <tr style="background-color:Crimson; color:Snow; font-size:large;"> <td...

How to get coldfusion DataSource list programmatically

Get ColdFusion DataSource list programmatically GetDataSourceList.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>DataSource List - how to get coldfusion DataSource list programmatically</title> </head> <body> <h2 style="color:Crimson; font-style:italic">DataSource example: how to get DataSource list</h2> <hr width="500" align="left" color="LightPink" /> <br /> <cfobject action="create" type="java" class="coldfusion.server.ServiceFactory" name="cfactory" > <cfset DSourceStruct=cfactory.getDataSourceService().getDataSources()> <cfset DSourceList=StructKeyList(DSourceStruct,",")> <table border="1" cellpadding="2" cellspacing=...

How to dump and get output server variables in coldfusion

Server variables serverVariables.cfm <!DOCTYPE html"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>server variables - how to dump and get output server variables</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">coldfusion server variables example: how to get output</h2> <hr width="500" align="left" color="PowderBlue" /> <br /> <cfdump var="#server#"> <br /> <font style="font-weight:bold; color:SeaGreen; font-size:large;">example server variable Output</font> <br /> <font style="color:DeepPink; font-weight:bold; font-family:'Courier New', Courier, monospace;"> PRODUCT VERSION[#server.ColdFusion.PRODUCTVERSION#]: <cfoutput>#server.ColdFusio...

How to Create a Microsoft Word Document in ColdFusion

Introduction In web development, generating documents dynamically, such as Microsoft Word files, can be highly valuable for businesses and users. ColdFusion, a powerful and flexible web development platform, allows developers to easily create Word documents using its built-in cfcontent tag. This tutorial demonstrates a practical example of how to output database query results into a Microsoft Word document using ColdFusion, showcasing how user-friendly the process can be. In this tutorial, we will cover two ColdFusion scripts: one for creating a hyperlink that triggers the Word document generation and another that processes the data from a database query and outputs it as a Word document. The focus will be on using the cfcontent tag to define the MIME type for Word files and how to structure and output the desired content. Overview of cfcontentMSWord.cfm The first part of the tutorial involves setting up a simple HTML page to serve as the user interface. The HTML file, named cfconten...

ColdFusion - how to create and dump Application variables

Application Variables application.cfm <cfapplication name="cfexample" clientmanagement="yes" sessionmanagement="yes" sessiontimeout="#CreateTimeSpan(0,0,30,0)#" > <cfset Application.Author.Name="cfsuman"> <cfset Application.Author.FavoriteColor="DeepPink"> <cfset Application.DSName="cfbookclub"> <cfset Application.Description="ColdFusion Example"> ApplicationVariables.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Application Variables: how to create and dump Application variables</title> </head> <body> <h2 style="color:Crimson; font-style:italic">ColdFusion Application Variables example: how to create and dump</h2> <hr width="600...

How to use AsyncFileUpload in asp.net ajax

AsyncFileUpload in asp.net ajax AsyncFileUpload is an asp.net ajax control. AsyncFileUpload control allow us to asynchronously upload files to web server. this control provide a way to check file uploading results both in the server side and client side. AsyncFileUpload control have the following useful properties those are CompleteBackColor, ContentType, ErrorBackColor, FileContent, FileName, HasFile, OnClientUploadComplete, OnClientUploadError, OnClientUploadStarted, PostedFile, ThrobberID, UploaderStyle, UploadingBackColor, and Width. AsyncFileUpload ajax control CompleteBackColor property value is a color name which color show as AsyncFileUpload control's background color when upload complete. ErrorBackColor property set a color name which color display as control's background color when file upload occurs an error. UploadingBackColor property assign a color name which color show as control's background color when file upload is in progres...