asp .net url variable select dropdown list

You would think it would be easy fro a Novice programmer to pre-select a dropdownlist with C# in ASP .Net from a url variable.

Well after an hour of fumbling around I was able to do it.

Page Code:

            Customer Assistance
            Client Assistance
            Aquisition and Sales
            Investor Relations
            Business Development


Page onLoad Code:

       string Department = Request.QueryString["dep"];
            if (!IsPostBack)
                    txtDepartment.Items.FindByValue(Department).Selected = true;
                    txtDepartment.Items.FindByValue("custlistitemomerservice").Selected = true;

Example URL Request:


Sign In

Reset Your Password