This walkthrough shows you how to configure Password as column type in WebGrid.
During this walkthrough, you will learn how to do the following :
- Bind WebGrid to datasource.
- Set CustomerID's column to password column.
Prerequisites
In order to complete this walkthrough, you will need the following:
- Access to the Microsoft Access Northwind database.
- Visual Studio 2003 Application.
Step-By-Step Instructions
To create new web application and set ColumnType as password.
- Binding WebGrid to AccessDataSource.
- Invoke the WebGrid's InitializeRow server side event to set the CustomerID's column type to password type.
C# Copy Code
if(e.Row.Type == ISNet.WebUI.WebGrid.RowType.Record)
{
string strCustomerID = e.Row.Cells.GetNamedItem("CustomerID").Text;
e.Row.Cells.GetNamedItem("CustomerID").Text = "<INPUT type=\"password\" value=\"" + strCustomerID + "\">";
}
- Finally, the WebForm will look like the following snapshot: