SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 102 | Next

Joydip Kanjilal

"ASP.NET Data Presentation Controls Essentials"

EditItemIndex = e.Item.ItemIndex;
DataList1.DataBind();
}
The .ItemIndex property of the DataListCommandEventArgs instance gives us the
row index of the DataList control that is being edited. This index starts with a value
of zero, that is, the index for the first row of data that is rendered in the DataList
control is 0.
Working with the DataList Control
[ 106 ]
The following screenshot shows the output on execution.
Note that the Edit command button is rendered for each of the rows of the DataList
control. Now, when you click on this button on any of the rows to edit the data for
that row, the output is as follows:
Note that the second record is set to editable mode on clicking the Edit command
button that corresponds to the second record.
How to enable/disable an embedded control within the
DataList control
To enable or disable any control contained within the DataList control,
use the following technique in the ItemDataBound event of the control.
Chapter 4
[ 107 ]
DataListProduct_ItemDataBound(object sender,
System.Web.UI.WebControls.DataListItemEventArgs e)
{
if ( e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem )
{
TextBox txtBox = e.Item.FindControl("txtEmpName") as TextBox;
txtBox.Visble=false;
}
}
Deleting Data
This section discusses how we can delete data using the DataList control.


Pages:
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6