Skip to main content

Posts

Showing posts from February, 2009

How to get file and directory list under a directory in coldfusion

cfdirectory - get file and directory list under a directory cfdirectoryList.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 cfdirectory tag example: how to get file and directory list under a directory</title> </head> <body> <h2 style="color:DodgerBlue">ColdFusion cfdirectory tag example: List</h2> <cfset CurrentDirectory=GetTemplatePath()> <cfset CurrentDirectory=ListDeleteAt(CurrentDirectory,ListLen(CurrentDirectory,"/\"),"/\")> <cfoutput> <b>Current Directory:</b> #CurrentDirectory# <br /> </cfoutput> <cfdirectory action="list" directory="#CurrentDirectory#" name="result"> <cfdump var="#result#"> </body> </html> More ColdFusion...

How to delete directory programmatically in coldfusion

Introduction In web development, managing server-side file systems efficiently is an essential task. Adobe ColdFusion offers several useful tags and functions to interact with files and directories, including the ability to programmatically create, modify, and delete directories. In this tutorial, we will explore how to delete a directory using the ColdFusion <cfdirectory> tag. This functionality is particularly useful for developers needing to automate file system management tasks, such as cleaning up unused directories or managing temporary files generated by web applications. This example demonstrates how to check if a directory exists on the server and, if it does, delete it using ColdFusion's native tags. We will walk through the structure and logic of the code, providing clear explanations of how it works and how you can apply it to similar scenarios. Displaying the Current Directory The code starts by setting the path of the directory we want to work with using the cf...

ColdFusion: How to create a directory programmatically

Introduction In this tutorial, we will explore how to programmatically create a directory using Adobe ColdFusion. ColdFusion is a powerful server-side scripting language, and one of its key features is the ease with which it can interact with the file system. By using the <cfdirectory> tag, ColdFusion allows developers to perform various directory operations, including creating, reading, and deleting directories. In this example, we focus on creating a new directory dynamically. Creating directories programmatically is a common task in web development, particularly when building applications that manage files or allow users to upload content. With ColdFusion, this process is simple and efficient. The tutorial walks through how to set up the environment, generate a new folder, and ensure that the directory is created in the desired location. Setting the Current Directory Path The first step in this example involves determining the current directory where the ColdFusion template i...

ColdFusion CFdbinfo - How to get column list from a table

cfdbinfo - get column list from a table cfdbinfoColumns.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 cfdbinfo tag example: how to get column list from a table</title> </head> <body> <h2 style="color:DodgerBlue">ColdFusion cfdbinfo tag example: Column List</h2> <cfdbinfo datasource="cfbookclub" table="Books" type="columns" name="result"> <cfquery dbtype="query" name="qColumnList"> SELECT COLUMN_NAME FROM result </cfquery> <cfdump var="#qColumnList#"> </body> </html> More ColdFusion examples cfdbinfo - get table name list from a datasource cfdbinfo - get system table name list from a datasource cfgrid - display data in a flash format grid cfgrid - displ...

asp.net - How to use custom image in a TreeView

Custom images in a TreeView The TreeView is an ASP.NET web server control. The TreeView is located under System.Web.UI.WebControls namespace. TreeView web server control displays hierarchical data. Such as a table of contents in a tree structure. The following ASP.NET C# tutorial code demonstrates how we can use custom images in a TreeView web server control. The asp.net c# developers can alter the appearance of the control to customize the images that are displayed in the TreeView control. The ASP.NET C# developers can specify their own custom set of images for the different parts of the TreeView control by setting the CollapseImageUrl, ExpandImageUrl, LineImagesFolder, and NoExpandImageUrl properties. The TreeView CollapseImageUrl property is the URL to an image displayed for the collapsible node indicator. This image is usually a minus sign (-). The ExpandImageUrl is the URL to an image displayed for the expandable node indicator. Thi...

How to get System Table names from a DataBase in ColdFusion

cfdbinfo - get system table name list from a datasource cfdbinfoSystemTableList.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 cfdbinfo tag example: how to get system table name list from a datasource</title> </head> <body> <h2 style="color:DodgerBlue">ColdFusion cfdbinfo tag example: System Table List</h2> <cfdbinfo datasource="cfartgallery" type="tables" name="qResult"> <cfquery dbtype="query" name="qSystemTableList"> SELECT TABLE_NAME FROM qResult WHERE TABLE_TYPE='SYSTEM TABLE' </cfquery> <cfdump var="#qSystemTableList#"> </body> </html> More ColdFusion examples cfdbinfo - get table name list from a datasource cfdbinfo - get column list from a table...

How to get Table names from a DataBase in ColdFusion

cfdbinfo - get table name list from a datasource cfdbinfo.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 cfdbinfo tag example: how to get table name list from a datasource</title> </head> <body> <h2 style="color:DodgerBlue">ColdFusion cfdbinfo tag example: Table List</h2> <cfdbinfo datasource="cfbookclub" type="tables" name="result"> <cfquery dbtype="query" name="qTableList"> SELECT TABLE_NAME FROM result WHERE TABLE_TYPE='TABLE' </cfquery> <cfdump var="#qTableList#"> </body> </html> More ColdFusion examples cfdbinfo - get system table name list from a datasource cfdbinfo - get column list from a table cfgrid - display data in a flash format grid cfgri...

RequiredFieldValidator to validate RadioButtonList in asp.net c#

RequiredFieldValidator to validate RadioButtonList RequiredFieldValidator validation control makes an asp.net web server input control like a mandatory field. Input control validation fails if the value of the control does not change from its initial value. So it will be a required field (input control) for submitting the web form. The user must input some value to pass the validation. You cannot pass validation by only entering space. You can set the RequiredFieldValidator InitialValue property to select another item except for the initial value for passing validation. You can set the ErrorMessage property value to display an error message when validation failed. This example demonstrates to you how can we validate RadioButtonList control using RequiredFieldValidator. This validation control makes RadioButtonList a mandatory (required) field. So the user must select (check) a list item from RadioButtonList to pass the validation and submit the for...

How to use HyperLink in asp.net

HyperLink Web Server Control HyperLink is an asp.net web server control. we can display a hyperlink on a web form page by inserting a HyperLink server control on the page. HyperLink sever control can render as either text or as graphics. HyperLink control generates a link that allows users to navigate to another page or another location on the same page. NavigateUrl property value stores the link destination. To display hyperlink control as text we need to set the Text property value and to display as an image set the ImageUrl property value. If we set both ImageUrl and Text property values, ImageUrl takes precedence. HyperLink server control's other important property is the Target property. The .net developers can specify the frame or window to display the linked page by this Target property settings. Target property has four possible values those are _blank, _parent, _self, and _top. The _blank value displays the destination page in a new windo...

How to use PlaceHolder in asp.net

PlaceHolder Server Control PlaceHolder is an asp.net web server control which used to store dynamically added web server controls on the web page. By using a PlaceHolder control we can dynamically add Label, TextBox, Button, RadioButton, Image, and many more web server controls in an asp.net web page. PlaceHolder server control act as a container control to store server controls that are dynamically added to the web page. PlaceHolder control does not provide any visible output. We only can see the dynamically added server controls inside a PlaceHolder control as child controls. We can add, insert and remove server controls programmatically in the PlaceHolder control. The following asp.net c# example code demonstrates to us how can we add server controls dynamically in a web page using PlaceHolder web server control. In the below example code, we put a PlaceHolder server control by declarative syntax. We also create a Button control with ...

ASP.NET RegularExpressionValidator - Validate U.S. Social Security Number

RegularExpressionValidator to validate US Social Security Number The RegularExpressionValidator control validates whether the value of an associated input control matches the pattern specified by a regular expression. The following asp.net c# tutorial code demonstrates how we can validate a US Social Security Number. We used a RegularExpressionValidator control and a RequiredFiledValidator control to validate a specified United States Social Security Number. A RegularExpressionValidator control checks whether the value of an input control (as an example a TextBox) matches a pattern defined by a regular expression. The regular expression validation allows the asp.net c# developers to check for predictable sequences of characters, such as those in Zip Codes, telephone numbers, and emails. But there is an issue while validating using RegularExpressionValidator control. If the specified input control is left empty the regular expression va...

ASP.NET RegularExpressionValidator - Validate U.S. Phone Number

RegularExpressionValidator to validate US Phone Number The RegularExpressionValidator control validates whether the value of an associated input control matches the pattern specified by a regular expression. The following asp.net c# tutorial code demonstrates how we can validate a US Phone Number. In the below example, we validated a United States Phone Number by using a RegularExpressionValidator control. The RegularExpressionValidator control checks whether the value of an input control (such as a TextBox) matches a pattern defined by a regular expression. Regular expression validation allows the asp.net c# developers to check for predictable sequences of characters, such as those in Zip Codes, telephone numbers, and URLs. When the input control (such as a TextBox) is empty, the regular expression validation will succeed. So, if a value is required for the associated input control (such as a TextBox), the asp.net c# developers have...

ASP.NET RegularExpressionValidator - Validate U.S. Zip Code

RegularExpressionValidator to validate US Zip Code The RegularExpressionValidator control validates whether the value of an associated input control matches the pattern specified by a regular expression. The following asp.net c# tutorial code demonstrates how we can validate a US Zip Code. In this example, we will validate the United States Zip Code with RegularExpressionValidator web server control. The RegularExpressionValidator web server control checks whether the value of an input control such as TextBox matches a pattern defined by a regular expression. This type of validation allows the asp.net developers to check for predictable sequences of characters, such as those in Zip Codes, telephone numbers, and URLs. If the input control such as TextBox is empty, the regular expression validation will succeed. So, if a value is required for the associated input control (TextBox), the asp.net developers have to use a RequiredFieldValida...

Validate an URL using RegularExpressionValidator in asp.net c#

URL validation using RegularExpressionValidator The RegularExpressionValidator control validates whether the value of an associated input control matches the pattern specified by a regular expression. The following asp.net c# tutorial code demonstrates how we can validate an URL. Here we will validate an URL by using the RegularExpressionValidator web server control. The RegularExpressionValidator web server control checks whether the value of an input control matches a pattern defined by a regular expression. This type of validation allows asp.net developers to check for predictable sequences of characters, such as those in email addresses, telephone numbers, and URLs. If the input control is empty, the validation will succeed. So, if a value is required for the associated input control, asp.net developers have to use a RequiredFieldValidator control in addition to the RegularExpressionValidator control. The RegularExpressionVal...

Validate an email address using RegularExpressionValidator in asp.net c#

RegularExpressionValidator - Validate email address RegularExpressionValidator control determines whether an input control's entered value matches a pattern defined by a regular expression. This validation control is very useful to check predictable sequences of characters. RegularExpressionValidator mostly uses to validate email addresses, social security numbers, telephone numbers, postal (zip) codes, etc. You also need to add a RequiredFieldValidator control because RegularExpressionValidator cannot validate empty value control. The Visual Studio and visual web developer .net IDE can auto-generate RegularExpressionValidator validation expression. It is a very useful and time-saving feature of visual studio. when validation failed RegularExpressionValidator control shows a predefined error message. This example demonstrates how can we validate user-inputted email addresses by RegularExpressionValidator. When the user inputs the email ad...