N
~~~ .NET Ed ~~~
Hi,
Since I ran into a problem with nested user web controls I decided I was
(???) better off implementing this as a custom web control. Well, I have run
into problems again... I created a new project on the solution that contains
the web page. That project is a Web Control Library type of project. I
created the new custom web control and can drag it to a page and it
functions but does not work as desired (see below).
To simplify the explanation, this custom web control is a composite control
with at least two drop down lists, say Countries and States. So far so good,
when the page is shown I see both drop down lists showing. The first one
(Countries) is data-bound and correctly reads the list (and populates the
drop down) of countries.
I have also defined a handler for the "selected item changed" of the
countries drop down but somehow it does not seem to be triggered. The drop
down list has its AutoPostBack set to true and I am able to see that when I
change the selection there IS a postback, only my event handler is not being
called.
[DefaultProperty("ShowExtendedLocation"),
ToolboxData("<{0}:WebLocationControl
runat=server></{0}:WebLocationControl>")]
public class WebLocationControl : System.Web.UI.WebControls.WebControl
{
private DropDownList dlCountry;private DropDownList dlProvince;
Since I ran into a problem with nested user web controls I decided I was
(???) better off implementing this as a custom web control. Well, I have run
into problems again... I created a new project on the solution that contains
the web page. That project is a Web Control Library type of project. I
created the new custom web control and can drag it to a page and it
functions but does not work as desired (see below).
To simplify the explanation, this custom web control is a composite control
with at least two drop down lists, say Countries and States. So far so good,
when the page is shown I see both drop down lists showing. The first one
(Countries) is data-bound and correctly reads the list (and populates the
drop down) of countries.
I have also defined a handler for the "selected item changed" of the
countries drop down but somehow it does not seem to be triggered. The drop
down list has its AutoPostBack set to true and I am able to see that when I
change the selection there IS a postback, only my event handler is not being
called.
[DefaultProperty("ShowExtendedLocation"),
ToolboxData("<{0}:WebLocationControl
runat=server></{0}:WebLocationControl>")]
public class WebLocationControl : System.Web.UI.WebControls.WebControl
{
private DropDownList dlCountry;private DropDownList dlProvince;