views:

321

answers:

2

I am in the middle of a project where I am migrating some code for a website from WebForms to MVC - unfortunatly there's not enough time to do it all at once, so I will have to do some... not so pretty solutions.

I am though facing a problems with a custom control I have written that inherits from the standard GridView control

namespace Controls {
    public class MyGridView : GridView { ... }
}

I have added to the web.config file as usual:

<configuration>
...
   <system.web>
   ...
      <pages>
      ...
         <controls>
         ...
         <add tagPrefix="Xui" namespace="Controls"/>
         </controls>
      </pages>
   </system.web>
</configuration>

Then on the MVC View:

<Xui:MyGridView ID="GridView1" runat="server" ...>...</Xui:MyGgridView>

However I am getting a parser error stating that the control cannot be found. I am suspecting this has to do with the mix up of MVC and WebForms, however I am/was under the impression that such mixup should be possible, is there any kind of tweak for this? I realise this solution is far from ideal, however there's no time to "do the right thing".

Thanks

A: 

Can't you use the <%@ Register %> directive directly in the view? Why do it in web.config, if it is not going to be used throughout the application? I'm not sure if it would work, as I haven't spent much time with ASP.NET MVC, but you can try.

Slavo
A: 

Sorry I forgot to add that I have already tried to use that as well, with the same result.

Also I will unfortunatly need to use it on several pages, so adding it to the web.config would be the ideal solution, however if there is a solution that just works on individual pages, then that would be more than acceptable as well.

kastermester