protected void btnApply_Click(object sender, EventArgs e) { //create an instance of the address collection ClsAddressCollection Addresses = new ClsAddressCollection(); Addresses.ReportByPostCode(txtFilter.Text); lstAddressList.DataSource = Addresses.AddressList; //set the name of the primary key lstAddressList.DataValueField = "AddressNo"; //set the name of the field to display lstAddressList.DataTextField = "PostCode"; //bind the data to the list lstAddressList.DataBind(); }
protected void btnClear_Click(object sender, EventArgs e) { //create an instance of the address collection ClsAddressCollection Addresses = new ClsAddressCollection(); Addresses.ReportByPostCode(""); //clear any existing filter to tidy up the interface txtFilter.Text = ""; lstAddressList.DataSource = Addresses.AddressList; //set the name of the primary key lstAddressList.DataValueField = "AddressNo"; //set the name of the field to display lstAddressList.DataTextField = "PostCode"; //bind the data to the list lstAddressList.DataBind(); }