I suggest you ...

Add parser support for strongly-typed controls

I think the model binding proposed in the Visual Studio 11 Preview is a great feature, but I think it could be made MUCH more powerful. I would like to see strongly-typed controls be something more like:

<asp:SomeControl ID="SomeControl1" runat="server" RuntimeType="string" />

Where SomeControl would be defined as:

public class SomeControl<T> : Control { }

And in the generated code, the markup would translate to:

protected SomeControl<string> SomeControl1;

The basic gist is to add in a special property like runat="Server" that would allow you to specify the T in Control<T> or T1 and T2 in Control<T1, T2>.

23 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Mark HildrethMark Hildreth shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Jeffrey MorseJeffrey Morse commented  ·   ·  Flag as inappropriate

        In addition to what has been suggested (which I woudl like to see better syntax):

        <ns:SomeControl{string} ID="SomeControl1" runat="server" />

        I would extend this by suggesting that markup fully support generics, such that a control could both instantiate a generic type by filling out the generic type parameters and use generic type parameters it defines itself (such as for a generic UserControl which could have a generic child as follows):

        public partial class MyUserControl<T> : UserControl
        {
        }

        Markup for MyUserControl<T>:

        <div>
        <ns:SomeControl{T} ID="SomeControl1" runat="server" />
        </div>

      Feedback and Knowledge Base