Can not call codebehind function for inherited dropdownlist

J

Joe

I wrote a customized dropdownlist by inheriting
System.Web.UI.WebControls.DropDownList

My dropdownlist has some of its own properties which need to be assigned in
runtime. In my aspx, I try to call a function from codebehind like this:

<MyControl:MyDropDownList id=MyDropDownList1 runat="server"
MyProperty="<%# Test1()%>"> DataTextField="<%# Test2()%>">

</MyControl:MyDropDownList>

It is strange that Test1() is not called at all for MyProperty. However,
Test2() is being called since DataTextField is a property for the base
class.

Does anyone know what is the problem? How should I implement a property of
a derived web control? Thank a lot for your time!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top