views:

30

answers:

1

how can i learn propert to create page form in asp.net


class MyClass
{
    public int id { get; set;}
    public string Name { get; set;}
    public string Name { get; set;}
}

ForExample : (To generate programmatically Asp.net forms)

 void SetRecursiveTextBoxAndLabels()
        {

            Label lbl;
                 MyClass eng = new MyClass();
                Type typ = eng.GetType();
                PropertyInfo[] properties = typ.GetProperties();
                for( int i =0;  i<properties.Length; i++)
                {
                    lbl = new Label();
                    lbl.ID = properties[i].Name;
                    lbl.Text = properties[i].Name;
                    PlaceHolder1.Controls.Add(lbl);
                }
            }
        }

But it is not run correctly:( loading is too slow... By the way i didn't create classıs in real time . i ama using linqtoSql . You can talk about solution wthi the base of linqtosql...

A: 

Have a look at Cache Reflection Results (Class Properties) and see if caching your reflection calls would help. As GenericTypeTea suggested, calling this multiple times is probably the cause of any delay you are seeing. Here is also a link to a Fast Reflection Library that may be a way to let someone else implement and debug the caching code for you.

Larry Smithmier