protected void Page_Load(object sender, EventArgs e) { ContentPlaceHolder ct = (ContentPlaceHolder)Master.FindControl(sender.ToString()); ControlCollection CCl = ct.Controls; foreach (Control ctrl in CCl) { if (this.Controls.GetType() == typeof(DropDownList)) { strDropDownID = ((DropDownList)ctrl).ID; if ((strDropDownID.Contains("ddlCountry")) || (strDropDownID.Contains("ddlFromCountry")) || (strDropDownID.Contains("ddlToCountry")) || (strDropDownID.Contains("ddlOrginCountry")) || (strDropDownID.Contains("ddlDestinationCountry"))) { ClientScriptManager cs = Page.ClientScript; // Check to see if the client script is already registered. if (!cs.IsClientScriptBlockRegistered(this.GetType(), "DropDownListScript")) { StringBuilder cstext2 = new StringBuilder(); cstext2.Append("<script type='text/javascript'> function SelectCountry('" + strDropDownID + "') {"); cstext2.Append("script>"); cs.RegisterClientScriptBlock(this.GetType(), "DropDownListScript", cstext2.ToString(), false); } } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)