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

Joydip Kanjilal

"ASP.NET Data Presentation Controls Essentials"

The code that creates a DropDownList in the
.aspx file follows:
OnSelectedIndexChanged="drpDept_SelectedIndexChanged"> DropDownList>
This control is bound to data using the DataManager class as usual.
protected void BindDepartmentList()
{
drpDept.DataSource = new DataManager().GetDepartmentList();
drpDept.DataTextField = "DeptName";
drpDept.DataValueField = "DeptCode";
drpDept.DataBind();
drpDept.Items.Insert(0, "All");
}
The string value All is stored in the initial index of the control, i.e., index 0. Hence,
selection of the first index would imply that the employee data of all the departments
would be displayed.
We will now take a variable called filterCondition that will contain the condition
based on which the data needs to be filtered.
private static String filterCondition = String.Empty;
The above variable is set to the appropriate department name based on the user's
selection in the DropDownList control.
The event handler drpDept_SelectedIndexChanged is called whenever the selected
index of the DropDownList control is changed. The source code for this event
handler is as follows:
protected void drpDept_SelectedIndexChanged(object sender, EventArgs
e)
{
if (drpDept.SelectedIndex == 0)
{
filterCondition = String.


Pages:
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6