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 99 | Next

Joydip Kanjilal

"ASP.NET Data Presentation Controls Essentials"


In the following sections, we will explore how to Select, Edit, and Delete data using
the DataList control.
Selecting Data
You need to specify the event handler that will be invoked in the OnItemCommand
event as follows:
OnItemCommand = "Employee_Select"
You also need to specify a LinkButton that the user would have to click on to select
a particular row of data in the DataList control. This command button would be
specified in the ItemTemplate as shown here:

Select

The reason why we choose to use the ItemTemplate to place the command button to
select data is that the contents of this template are rendered once for each row of data
in the DataList control. The code for the event handler is as follows:
protected void Employee_Select(object source,
DataListCommandEventArgs e)
{
DataList1.EditItemIndex = e.Item.ItemIndex;
DataList1.DataBind();
}
The output on execution is shown in the following screenshot.
Chapter 4
[ 103 ]
Resizing a DataList control when the browser's size changes
When you change the width or height of a browser that has a DataList
control in it, the size of the DataList doesn't change. Here is a workaround
to this.
Create a CSS class that you will use in as the control's CssClass as
shown below.


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