Click here to Skip to main content
15,920,896 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionPassing Varible to Crystal report from the ASP page Pin
kimo code24-Aug-08 0:24
kimo code24-Aug-08 0:24 
AnswerRe: Passing Varible to Crystal report from the ASP page Pin
Blue_Boy24-Aug-08 4:46
Blue_Boy24-Aug-08 4:46 
QuestionCustome Control Problem Pin
Muhammad Gouda24-Aug-08 0:08
Muhammad Gouda24-Aug-08 0:08 
AnswerRe: Custome Control Problem Pin
Abhijit Jana24-Aug-08 0:35
professionalAbhijit Jana24-Aug-08 0:35 
GeneralCustome Control cannot be obtained from Generic Class Pin
Muhammad Gouda24-Aug-08 0:37
Muhammad Gouda24-Aug-08 0:37 
GeneralRe: Custome Control cannot be obtained from Generic Class Pin
Abhijit Jana24-Aug-08 1:12
professionalAbhijit Jana24-Aug-08 1:12 
GeneralRe: Custome Control cannot be obtained from Generic Class Pin
N a v a n e e t h24-Aug-08 6:34
N a v a n e e t h24-Aug-08 6:34 
AnswerRe: Custome Control Problem Pin
N a v a n e e t h24-Aug-08 6:31
N a v a n e e t h24-Aug-08 6:31 
AFAIK, you can't use generics here as you won't be able to view this control in the designer if you have a generic type with your class declaration. But you could do something like this
class YourClass
    {
        public Type Property1Type { get; set; }

        object property1;
        public object Property1 
        {
            get { return property1; }
            set
            {
                if (value.GetType() == this.Property1Type)
                    property1 = value;
                else
                    throw new Exception("Invalid type");
            }
        }
    }

YourClass a = new YourClass();
a.Property1Type = typeof(System.String);
a.Property1 = "Hello";
Above code allows to set only the specified type to "Property1". I am not sure this is the correct approach though. If you could tell me why you need this, there may be better ways to do this.

If you don't want designer support for this control you can use generic parameter with the class declaration. Then the code will be pretty nice.
class YourClassInGenerics<Property1Type>
{
    public Property1Type Property1 { get; set; }
}

YourClassInGenerics<string> yourClass = new YourClassInGenerics<string>();
yourClass.Property1 = "Hello";


All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia

How to use google | Ask smart questions

GeneralRe: Custome Control Problem Pin
Abhijit Jana24-Aug-08 18:13
professionalAbhijit Jana24-Aug-08 18:13 
GeneralRe: Custome Control Problem Pin
N a v a n e e t h24-Aug-08 18:20
N a v a n e e t h24-Aug-08 18:20 
GeneralRe: Custome Control Problem Pin
Abhijit Jana24-Aug-08 18:26
professionalAbhijit Jana24-Aug-08 18:26 
GeneralRe: Custome Control Problem Pin
Muhammad Gouda24-Aug-08 22:01
Muhammad Gouda24-Aug-08 22:01 
GeneralRe: Custome Control Problem Pin
N a v a n e e t h25-Aug-08 7:09
N a v a n e e t h25-Aug-08 7:09 
GeneralRe: Custome Control Problem Pin
Muhammad Gouda25-Aug-08 21:28
Muhammad Gouda25-Aug-08 21:28 
AnswerRe: Custome Control Soulution Pin
Muhammad Gouda24-Aug-08 21:46
Muhammad Gouda24-Aug-08 21:46 
Question0 size of child controls of UpdatePanel [modified] at runtime Pin
Neeraj Arora24-Aug-08 0:06
Neeraj Arora24-Aug-08 0:06 
AnswerRe: 0 size of child controls of UpdatePanel [modified] at runtime Pin
Brij24-Aug-08 2:57
mentorBrij24-Aug-08 2:57 
QuestionReDim Preserve data(totalBytesRead + dataBlock) to C# Pin
aref8724-Aug-08 0:00
aref8724-Aug-08 0:00 
AnswerRe: ReDim Preserve data(totalBytesRead + dataBlock) to C# Pin
Guffa24-Aug-08 12:18
Guffa24-Aug-08 12:18 
GeneralRe: ReDim Preserve data(totalBytesRead + dataBlock) to C# Pin
aref8724-Aug-08 23:04
aref8724-Aug-08 23:04 
GeneralRe: ReDim Preserve data(totalBytesRead + dataBlock) to C# Pin
Guffa25-Aug-08 20:18
Guffa25-Aug-08 20:18 
Questioncheck email address is correct or not without sending email Pin
help as an alias23-Aug-08 10:57
help as an alias23-Aug-08 10:57 
AnswerRe: check email address is correct or not without sending email Pin
N a v a n e e t h23-Aug-08 18:20
N a v a n e e t h23-Aug-08 18:20 
AnswerRe: check email address is correct or not without sending email Pin
Paul Conrad23-Aug-08 18:52
professionalPaul Conrad23-Aug-08 18:52 
GeneralRe: check email address is correct or not without sending email Pin
help as an alias24-Aug-08 6:33
help as an alias24-Aug-08 6:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.