views:

201

answers:

1

I have a custom Grid view object that inherits from the base System.Web.UI.WebControls.GridView. The code is in a class file. How do I reference this class file in my aspx page?

I tried using:

<%@ Register Namespace="SRC.Web.Common" TagPrefix="custom"%>

But my intelliSense will not pick up my new reference. I would pefer not creating a user control.

+1  A: 

In here he says that registering your control at web.config will get intellisense support.

You can register your custom control as :

<configuration>

  <system.web>

    <pages>
      <controls>
        <add tagPrefix="custom" assembly="SRC.Web.Common"/>
      </controls>
    </pages>

  </system.web>

</configuration>

hope this helps !

Canavar
The assembly and namespace attributes are not necessarily the same value. When using this approach, you may have to specify both if the assembly name is different from your namespace. Example:<add tagPrefix="custom" namespace="SRC.Web.Common" assembly="MyCustomCode"/>
Jay S
Yes you're right, but I assume that they are same, because we both don't know this information ;)
Canavar