473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Question about a user control derived from DropDownList

I have a simple control that is in a CS file (not ASCX). It is derived
from DropDownList like this

public class FiltersDropDown : DropDownList
{
....
}

It overrides a couple of functions. I want to include this
FiltersDropDown control in an ASPX file. I know how to use the "@
register" directive to include an ASCX file, but it doesn't seem to
work when the control is defined in a CS file. If I put the CS file in
a library (DLL) I am able to access it, but I don't want to put it in a
libarary; I just want to include it in the web site like a regular
file. I have tried putting it in the root directory of the website, a
custom subdirectory, or the app_code subdirectory, without any success.
Any ideas? I am using ASP.NET 2.0

Thanks in advance,
John

Nov 7 '06 #1
2 3935
Try this out,

<%@ Register Src="~/foldername/FiltersDropDown .cs"
TagName="FiltersDropDown"
TagPrefix="FDD" %>

Thanks
Thiagarajan Rajendran

Big Daddy wrote:
I have a simple control that is in a CS file (not ASCX). It is derived
from DropDownList like this

public class FiltersDropDown : DropDownList
{
...
}

It overrides a couple of functions. I want to include this
FiltersDropDown control in an ASPX file. I know how to use the "@
register" directive to include an ASCX file, but it doesn't seem to
work when the control is defined in a CS file. If I put the CS file in
a library (DLL) I am able to access it, but I don't want to put it in a
libarary; I just want to include it in the web site like a regular
file. I have tried putting it in the root directory of the website, a
custom subdirectory, or the app_code subdirectory, without any success.
Any ideas? I am using ASP.NET 2.0

Thanks in advance,
John
Nov 7 '06 #2
Nope, it doesn't work. The compiler gives me this error on the @
Register directive:

"The file 'src' is not a valid here because it doesn't expose a type"

Any other ideas?
Thanks,
John

rajkushi wrote:
Try this out,

<%@ Register Src="~/foldername/FiltersDropDown .cs"
TagName="FiltersDropDown"
TagPrefix="FDD" %>
Nov 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris | last post by:
I have a question on whether or not this is good practice. I have a fairly complex web user control (a datalist embedded in a datalist with lots of controls) that I will call Usercontrol1 and a...
1
by: Roman | last post by:
I have built a simple user control that contains 2 buttons, a text box and a dropdownlist. When a button is clicked it sets the visible property of the textbox/dropdownlist and the button. ie the...
3
by: Vivek Sharma | last post by:
Hi, I have created a dropdownlist as a web user control. I am using its multiple instances on the webpage. How do I access the selectedValue of each instance? All the instances have different...
1
by: Moshfegh Hamedani | last post by:
Hi there, I found this question in Amit Kalani's preparation book for exam 70-15 (Developing Web Applications with C#). I think it's a very stupid question! It says the correct answer is A but...
0
by: Moshfegh Hamedani | last post by:
Hi there, I found this question in Amit Kalani's preparation book for exam 70-15 (Developing Web Applications with C#). I think it's a very stupid question! It says the correct answer is A but...
2
by: Roman | last post by:
I have built a simple user control that contains 2 buttons, a text box and a dropdownlist. When a button is clicked it sets the visible property of the textbox/dropdownlist and the button. ie the...
6
by: Rajesh C K R | last post by:
Hi, Why do some always needed to be placed inside a <form runat=server> where as few other dont require that? How do I know if a given control (derived from System.Web.UI.Control or...
5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
1
by: DJ | last post by:
I have a DropDownList in Visual Web Developer that is databound to a SQL Database. Whenever the web page is opened the DropDownList is automatically filled with the first item in the table. My...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.