Search

You searched for the word(s): userid:771623

Matching Posts

  • Re: How to list class properties that are classes too (Reflections)?

    Thank you!! Just wanted to share my end result, which is an extension to convert a DataTable to a collection of a classes (strong-typed). It does this by accepting a hashtable that maps the columns of the DataTable to the property names of the class. Pls share any comments on this if any: public static List<T> ToClassCollection<T>(this DataTable param, Hashtable mappings) where T : new() { List<T> col = new List<T>(); foreach (DataRow row in param.Rows) { if (row.HasErrors
    Posted to C# (Forum) by blove57 on 11/18/2008
  • How to list class properties that are classes too (Reflections)?

    I can assign a property value in a class by just knowing the string name of the property, like this: Product oProduct = new Product(); string propertyName = "Image"; PropertyInfo propertyInfo = oProduct.GetType().GetProperty(propertyName ); propertyInfo.SetValue(oProduct, "test.jpg", null); My problem is when the property of the class is another class, like MetaData here: public class Product { private string _productID = String . Empty ; public string ProductID { get { return
    Posted to C# (Forum) by blove57 on 11/17/2008
  • Re: CSS stylesheet not applied after PostBack

    I don't think it's anything wrong with my code because the fact that the right CSS file is in the source code of the resultant html page confirms that. I have a suspicion that's it's some .NET feature that's being overly clear and can't figure it out.
    Posted to Web Forms (Forum) by blove57 on 5/8/2008
  • CSS stylesheet not applied after PostBack

    I have an aspx page where I have a dropdown full of css stylesheets for setting styles on the page. During the postback the styles set for the page using the css are not retained. Instead the previous styles (font - size, family, layout, etc) are applied. If I reload the page from there, the new CSS styles are applied correctly to the page. I want the styles from the css to be applied for the page on the return of the postback but no avail. I also wanted to point out that if I view the source to
    Posted to Web Forms (Forum) by blove57 on 5/7/2008
  • Wildcard application maps in IIS7 from Web.config?

    Is there a way to turn on wildcard mapping in IIS7 from the Web.config file? I have a .NET 3.5 website with a few C# HTTP Modules such as URL redirect scripts that required "Wildcard application maps" turned on for the .NET framework (pointed to the same dll as what .aspx uses). Right now the website is running on IIS6 and did this thru the IIS6 management console. But now I've moved the website to a IIS7 shared hosting and now wanted to turn Wildcard application mapping via the Web
    Posted to HttpHandlers and HttpModules (Forum) by blove57 on 3/29/2008
  • For generic types, what does "where T : class, new()" mean??

    I understand what generic types are and it's really amazing what you can do with it. But I've seen sometimes where you have to put the where command after like: public T SomeMethod < T >( string item ) where T : class ; public T SomeMethod < T >( string item ) where T : new() ; What does the "where" mean and is there anything else besides class and new()?
    Posted to C# (Forum) by blove57 on 3/11/2008
  • Re: How do I create an instance with generic types with Activator.CreateInstance?

    I got it! Phew did I have to dig. It has very weird syntax with a backtick and brackets. Initially I tried following the MSDN guide on GetType (two-thirds down the page: http://msdn2.microsoft.com/en-us/library/w3f99sx1.aspx) which told me to do the following but still came up with a null: Type constructedType = Type.GetType("MyClass`1[Customer]"); So in the end, this finally worked for me: Type classType = Type.GetType("MyClass`1"); Type[] typeParams = new Type[] { typeof(Customer
    Posted to C# (Forum) by blove57 on 3/6/2008
  • Re: How do I create an instance with generic types with Activator.CreateInstance?

    Just to add to my original post, I even tried hardcoding everything like this and still gave me a null exception: MyBaseClass<Customer> customerProvider = Activator.CreateInstance("MyClass<Customer>"); And just to make sure I wasn't doing anything stupid somewhere, doing this worked fine: MyBaseClass<Customer> customerProvider = new MyClass<Customer>(); Any idea on how to achieve this with Activator.CreateInstance?
    Posted to C# (Forum) by blove57 on 3/6/2008
  • How do I create an instance with generic types with Activator.CreateInstance?

    I have a class that has a generic type and I'm trying to create an instance using the activator but having trouble with it. This is what I have: public abstract class MyBaseClass<T> where T : new() { ... public abstract T DoSomething(); } public class MyClass<T> : MyBaseClass<T> where T : new() { ... public override T DoSomething() { .. } } And this is what I'm trying to do but didn't work. This gives my a null error: System.ArgumentNullException: Value cannot be null
    Posted to C# (Forum) by blove57 on 3/5/2008
  • Re: How do I serialize my classes for Session State mode?

    Excellent. It was a lot easier than I thought. Thanks.
    Posted to State Management (Forum) by blove57 on 1/30/2008
Page 1 of 3 (21 items) 1 2 3 Next >