Click here to Skip to main content
15,925,661 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: ASP.Net Ajax Best (or Correct?) Pratice Pin
Not Active7-Feb-07 7:34
mentorNot Active7-Feb-07 7:34 
GeneralRe: ASP.Net Ajax Best (or Correct?) Pratice Pin
Clickok7-Feb-07 13:22
Clickok7-Feb-07 13:22 
QuestionTouch Scrren Application Pin
chaks767-Feb-07 6:25
chaks767-Feb-07 6:25 
Question2.0 UserCtrol and Styles Pin
Tim McCurdy7-Feb-07 6:17
Tim McCurdy7-Feb-07 6:17 
AnswerRe: 2.0 UserCtrol and Styles Pin
minhpc_bk7-Feb-07 14:02
minhpc_bk7-Feb-07 14:02 
QuestionSession_Start firing many times Pin
eggsovereasy7-Feb-07 5:31
eggsovereasy7-Feb-07 5:31 
AnswerRe: Session_Start firing many times Pin
eggsovereasy7-Feb-07 9:25
eggsovereasy7-Feb-07 9:25 
QuestionSetting property via Reflection Pin
szukuro7-Feb-07 5:06
szukuro7-Feb-07 5:06 
I want set properties to a WebControl via Reflection. The corresponding code snippet is something like this:

public void SetProperty(Control control, string propertyname, string propertyvalue)
{
   Type type = control.GetType();
   System.Reflection.PropertyInfo pi = type.GetProperties(propertyname);
   object value = Convert.ChangeType(propertyvalue, pi.PropertyType);
   pi.SetValue(control, value, null);
}

It works for most cases, but for special types like Unit or Color (Width or ForeColor for example), I get an Exception. I made some ifs for a few types so that I convert/parse them specifically to the type needed. But this way the code is quite ugly and is not guaranteed to work all the time. Anyone else know a better solution?
AnswerRe: Setting property via Reflection Pin
minhpc_bk7-Feb-07 14:13
minhpc_bk7-Feb-07 14:13 
GeneralRe: Setting property via Reflection Pin
szukuro7-Feb-07 14:30
szukuro7-Feb-07 14:30 
GeneralRe: Setting property via Reflection Pin
minhpc_bk7-Feb-07 14:54
minhpc_bk7-Feb-07 14:54 
GeneralRe: Setting property via Reflection Pin
szukuro8-Feb-07 2:19
szukuro8-Feb-07 2:19 
GeneralRe: Setting property via Reflection Pin
minhpc_bk8-Feb-07 15:42
minhpc_bk8-Feb-07 15:42 
GeneralRe: Setting property via Reflection Pin
szukuro8-Feb-07 21:26
szukuro8-Feb-07 21:26 
QuestionNegative Amounts? Pin
Murthy Puvvada7-Feb-07 4:24
Murthy Puvvada7-Feb-07 4:24 
AnswerRe: Negative Amounts? Pin
Colin Angus Mackay7-Feb-07 4:48
Colin Angus Mackay7-Feb-07 4:48 
JokeRe: Negative Amounts? Pin
DavidNohejl7-Feb-07 4:59
DavidNohejl7-Feb-07 4:59 
GeneralRe: Negative Amounts? Pin
_AK_7-Feb-07 17:31
_AK_7-Feb-07 17:31 
AnswerRe: Negative Amounts? Pin
DavidNohejl7-Feb-07 5:02
DavidNohejl7-Feb-07 5:02 
GeneralRe: Negative Amounts? Pin
Murthy Puvvada7-Feb-07 5:19
Murthy Puvvada7-Feb-07 5:19 
AnswerRe: Negative Amounts? Pin
Guffa7-Feb-07 6:20
Guffa7-Feb-07 6:20 
GeneralRe: Negative Amounts? Pin
Murthy Puvvada7-Feb-07 6:38
Murthy Puvvada7-Feb-07 6:38 
QuestionCan't retrieve data out of a GridView Control Pin
Quecumber2567-Feb-07 4:08
Quecumber2567-Feb-07 4:08 
AnswerRe: Can't retrieve data out of a GridView Control Pin
minhpc_bk7-Feb-07 13:58
minhpc_bk7-Feb-07 13:58 
GeneralRe: Can't retrieve data out of a GridView Control Pin
Quecumber2568-Feb-07 3:12
Quecumber2568-Feb-07 3:12 

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.