Events not firing in ToolPart

2. May 2007 10:35 by Mrojas in General  //  Tags:   //   Comments (0)
I was developing a WebPart and I came up with a situation where my custom ToolPart did not fired the events. I found this post that solved the problem. " I moved the databinding code into the CreateChildControls() code: protected override void CreateChildControls() { dllCatagory = new DropDownList(); dllCatagory.Visible = true; dllCatagory.AutoPostBack = true; dllCatagory.Attributes.Add("runat", "server"); dllCatagory.SelectedIndexChanged += new EventHandler(dllCatagory_SelectedIndexChanged); CdCatagoryList.CatagoryList cdCatL; cdCatL = new CdCatagoryList.CatagoryList(); //cdCat.Catlist is a dll that will get the data. DataView tviewFolders = cdCatL.CatList(true, "cdadmin", "", "server=192.168.221.246;uid=DataSa;pwd=pa456;database=ContentDepot"); dllCatagory.DataSource = tviewFolders; dllCatagory.DataValueField = "FolderNumber"; dllCatagory.DataTextField = "FolderName"; dllCatagory.DataBind(); Controls.Add(dllCatagory); } public void dllCatagory_SelectedIndexChanged(object sender, EventArgs e) { //Code to load the gridview //This event now fires} protected override void RenderToolPart(HtmlTextWriter output) { EnsureChildControls(); dllCatagory.RenderControl(output); } "