Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Inherited controls in datagrid template columns

Inherited controls in datagrid template columns

Scheduled Pinned Locked Moved ASP.NET
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    danasegaranea
    wrote on last edited by
    #1

    Hi all, I have created inherited HyperLinkUser control as follows

    Public Class ResourceHyperLink
    Inherits HyperLink
    Private m_ResourceID As Integer
    Private m_ResouceName As String

        Public Property ResourceName() As String
            Get
                ResourceName = m\_ResouceName
            End Get
            Set(ByVal Value As String)
                m\_ResouceName = ResourceName
            End Set
        End Property
    
        Public Property ResourceID() As String
            Get
                ResourceID = m\_ResourceID
            End Get
            Set(ByVal Value As String)
                m\_ResourceID = ResourceID
            End Set
        End Property
    End Class
    

    Can I able to add this control in the datagrid Itemtemplate

    asp:TemplateColumn
    <ItemTemplate>
    'HERE </ItemTemplate>
    </asp:TemplateColumn>

    N 1 Reply Last reply
    0
    • D danasegaranea

      Hi all, I have created inherited HyperLinkUser control as follows

      Public Class ResourceHyperLink
      Inherits HyperLink
      Private m_ResourceID As Integer
      Private m_ResouceName As String

          Public Property ResourceName() As String
              Get
                  ResourceName = m\_ResouceName
              End Get
              Set(ByVal Value As String)
                  m\_ResouceName = ResourceName
              End Set
          End Property
      
          Public Property ResourceID() As String
              Get
                  ResourceID = m\_ResourceID
              End Get
              Set(ByVal Value As String)
                  m\_ResourceID = ResourceID
              End Set
          End Property
      End Class
      

      Can I able to add this control in the datagrid Itemtemplate

      asp:TemplateColumn
      <ItemTemplate>
      'HERE </ItemTemplate>
      </asp:TemplateColumn>

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      danasegaranea wrote:

      Can I able to add this control in the datagrid Itemtemplate

      Yes you can do that. What's the problem you are facing here ?

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      D 1 Reply Last reply
      0
      • N N a v a n e e t h

        danasegaranea wrote:

        Can I able to add this control in the datagrid Itemtemplate

        Yes you can do that. What's the problem you are facing here ?

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

        D Offline
        D Offline
        danasegaranea
        wrote on last edited by
        #3

        Thanks for the post Navaneeth, I tried like this

        asp:TemplateColumn
        <ItemTemplate>
        <asp:ResourceHyperLink ID="lblResource_First" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ResourcesName_Left") %>' BorderColor="white" >
        </asp:ResourceHyperLink>
        </ItemTemplate>
        </asp:TemplateColumn>

        And got the error as The active schema doesnot support

        N 1 Reply Last reply
        0
        • D danasegaranea

          Thanks for the post Navaneeth, I tried like this

          asp:TemplateColumn
          <ItemTemplate>
          <asp:ResourceHyperLink ID="lblResource_First" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ResourcesName_Left") %>' BorderColor="white" >
          </asp:ResourceHyperLink>
          </ItemTemplate>
          </asp:TemplateColumn>

          And got the error as The active schema doesnot support

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          Have you tried putting a simple text value ? Remove DataBinder.Eval(Container.DataItem, "ResourcesName_Left") and put a simple text there. Just check if it is working ?

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

          D 1 Reply Last reply
          0
          • N N a v a n e e t h

            Have you tried putting a simple text value ? Remove DataBinder.Eval(Container.DataItem, "ResourcesName_Left") and put a simple text there. Just check if it is working ?

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

            D Offline
            D Offline
            danasegaranea
            wrote on last edited by
            #5

            I tried like this

            <ItemTemplate>
            <asp:ResourceHyperLink ID="lblResource_First" Runat="server" Text='My' BorderColor="white" >
            </asp:ResourceHyperLink>
            </ItemTemplate>
            asp:TemplateColumn

            and got the error as

            Parser Error
            Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

            Parser Error Message: Could not load type System.Web.UI.WebControls.ResourceHyperLink from assembly System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

            Source Error:

            Line 322: asp:TemplateColumn
            Line 323: <ItemTemplate>
            Line 324: <asp:ResourceHyperLink ID="lblResource_First" Runat="server" Text='My' BorderColor="white" >
            Line 325: </asp:ResourceHyperLink>
            Line 326: </ItemTemplate>

            N 1 Reply Last reply
            0
            • D danasegaranea

              I tried like this

              <ItemTemplate>
              <asp:ResourceHyperLink ID="lblResource_First" Runat="server" Text='My' BorderColor="white" >
              </asp:ResourceHyperLink>
              </ItemTemplate>
              asp:TemplateColumn

              and got the error as

              Parser Error
              Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

              Parser Error Message: Could not load type System.Web.UI.WebControls.ResourceHyperLink from assembly System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

              Source Error:

              Line 322: asp:TemplateColumn
              Line 323: <ItemTemplate>
              Line 324: <asp:ResourceHyperLink ID="lblResource_First" Runat="server" Text='My' BorderColor="white" >
              Line 325: </asp:ResourceHyperLink>
              Line 326: </ItemTemplate>

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              It looks like you haven't registered your control assembly. So default ASP.NET will look in System.Web.UI.WebControls and throws this error. Add the below tag to top of your page.

              <%@ Register Assembly="AssemblyName" Namespace="YourNameSpace" TagPrefix="cc1" %>

              In your sample, call this like

              <cc1:ResourceHyperLink ID="lblResource_First" Runat="server" Text='My' BorderColor="white" > </cc1:ResourceHyperLink>

              All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups