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. ASP.NET Custom Controls

ASP.NET Custom Controls

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netsysadminquestion
3 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.
  • A Offline
    A Offline
    Andy M
    wrote on last edited by
    #1

    I'm creating an ASP.NET custom control that will display several LinkButton derived objects with a separator graphic between them. My problem is that I keep getting the following error message if I attempt to put in any LinkButton derived objects: Type 'Lux.Presentation.LuxControls.LuxLinkItem' in Assembly 'Lux.Presentation.LuxControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable." I'm not sure why it needs to be serializable. I can't find out any reason for this. So, I added the Serializable attribute and I get almost the same error again, but for the LinkButton class. Since the Microsoft control doesn't need to be serializable, I can't see why mine should need to be. I'm obviously missing some piece of the puzzle. Here is what the code on the ASPX page looks like:

    <Lux:LuxLinks ID="LuxLinks1" runat="server" SeparatorImageUrl="~/bullet.gif" Width="100%" >
    <Items>
    <Lux:LuxLinkItem runat="server" ID="lli1">First Link Button</Lux:LuxLinkItem>
    </Items>
    </Lux:LuxLinks>

    Does anyone have any ideas? Is there anything I could try out?

    P 1 Reply Last reply
    0
    • A Andy M

      I'm creating an ASP.NET custom control that will display several LinkButton derived objects with a separator graphic between them. My problem is that I keep getting the following error message if I attempt to put in any LinkButton derived objects: Type 'Lux.Presentation.LuxControls.LuxLinkItem' in Assembly 'Lux.Presentation.LuxControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable." I'm not sure why it needs to be serializable. I can't find out any reason for this. So, I added the Serializable attribute and I get almost the same error again, but for the LinkButton class. Since the Microsoft control doesn't need to be serializable, I can't see why mine should need to be. I'm obviously missing some piece of the puzzle. Here is what the code on the ASPX page looks like:

      <Lux:LuxLinks ID="LuxLinks1" runat="server" SeparatorImageUrl="~/bullet.gif" Width="100%" >
      <Items>
      <Lux:LuxLinkItem runat="server" ID="lli1">First Link Button</Lux:LuxLinkItem>
      </Items>
      </Lux:LuxLinks>

      Does anyone have any ideas? Is there anything I could try out?

      P Offline
      P Offline
      Paddy Boyd
      wrote on last edited by
      #2

      Do you add the controls to the viewstate? An object must be serializable to be saved in viewstate.

      A 1 Reply Last reply
      0
      • P Paddy Boyd

        Do you add the controls to the viewstate? An object must be serializable to be saved in viewstate.

        A Offline
        A Offline
        Andy M
        wrote on last edited by
        #3

        Paddy Boyd wrote:

        Do you add the controls to the viewstate? An object must be serializable to be saved in viewstate.

        :doh: That makes sense. I've altered my Load and Save Viewstate methods and it works now. I was just dumping the items directly into the viewstate. I though it would automatically call Load/SaveViewstate as needed. Thanks. I've got this working now.

        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