Data Repeater - Dynamic template depending on data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dunc

    Data Repeater - Dynamic template depending on data

    I have a repeater that I need to display one of three different templates,
    depending on a status bit in the data (e.g. if status = 0, display a basic
    template, 1 = with picture, 2 = with picture + extra text)

    Is this possible? If so, does anyone have a link to a good tutorial or
    example?

    Thanks in advance,

    Duncan


  • Ignacio Machin \( .NET/ C# MVP \)

    #2
    Re: Data Repeater - Dynamic template depending on data

    Hi,

    Well you have two choises:
    1- Create 3 Repeaters and bind/show the needed one. This is the easiest
    solution just that you create two controls that you know for sure you will
    not use. Even so I believe this is the way to go.
    2- Create the ItemTemplate collection to build the control as needed, this
    is more error prone and you will need more code for it.


    cheers,

    --
    Ignacio Machin,
    ignacio.machin AT dot.state.fl.us
    Florida Department Of Transportation



    "Dunc" <dunc@ntpcl.f9. co.uk> wrote in message
    news:uCpjtEpaFH A.3364@TK2MSFTN GP09.phx.gbl...[color=blue]
    >I have a repeater that I need to display one of three different templates,
    >depending on a status bit in the data (e.g. if status = 0, display a basic
    >template, 1 = with picture, 2 = with picture + extra text)
    >
    > Is this possible? If so, does anyone have a link to a good tutorial or
    > example?
    >
    > Thanks in advance,
    >
    > Duncan
    >[/color]


    Comment

    • Dunc

      #3
      Re: Data Repeater - Dynamic template depending on data

      Sorry - think I phrased that badly. One list could potentially contain all
      three different layouts, at any given location.

      Any other thoughts?

      Duncan


      "Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
      in message news:ud4VmTpaFH A.740@tk2msftng p13.phx.gbl...[color=blue]
      > Hi,
      >
      > Well you have two choises:
      > 1- Create 3 Repeaters and bind/show the needed one. This is the easiest
      > solution just that you create two controls that you know for sure you will
      > not use. Even so I believe this is the way to go.
      > 2- Create the ItemTemplate collection to build the control as needed, this
      > is more error prone and you will need more code for it.
      >
      >
      > cheers,
      >
      > --
      > Ignacio Machin,
      > ignacio.machin AT dot.state.fl.us
      > Florida Department Of Transportation
      >
      >
      >
      > "Dunc" <dunc@ntpcl.f9. co.uk> wrote in message
      > news:uCpjtEpaFH A.3364@TK2MSFTN GP09.phx.gbl...[color=green]
      >>I have a repeater that I need to display one of three different templates,
      >>depending on a status bit in the data (e.g. if status = 0, display a basic
      >>template, 1 = with picture, 2 = with picture + extra text)
      >>
      >> Is this possible? If so, does anyone have a link to a good tutorial or
      >> example?
      >>
      >> Thanks in advance,
      >>
      >> Duncan
      >>[/color]
      >
      >[/color]


      Comment

      • Ignacio Machin \( .NET/ C# MVP \)

        #4
        Re: Data Repeater - Dynamic template depending on data

        Hi,

        It does not matter, the list is the datasource, the repeaters are just the
        way you will show it, are the repeaters the one that show it differently.

        I still think the idea of having 3 repeaters and showing only the one you
        want is the best option

        cheers,

        --
        Ignacio Machin,
        ignacio.machin AT dot.state.fl.us
        Florida Department Of Transportation



        "Dunc" <dunc@ntpcl.f9. co.uk> wrote in message
        news:euaCsupaFH A.3528@TK2MSFTN GP09.phx.gbl...[color=blue]
        > Sorry - think I phrased that badly. One list could potentially contain
        > all three different layouts, at any given location.
        >
        > Any other thoughts?
        >
        > Duncan
        >
        >
        > "Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
        > wrote in message news:ud4VmTpaFH A.740@tk2msftng p13.phx.gbl...[color=green]
        >> Hi,
        >>
        >> Well you have two choises:
        >> 1- Create 3 Repeaters and bind/show the needed one. This is the easiest
        >> solution just that you create two controls that you know for sure you
        >> will not use. Even so I believe this is the way to go.
        >> 2- Create the ItemTemplate collection to build the control as needed,
        >> this is more error prone and you will need more code for it.
        >>
        >>
        >> cheers,
        >>
        >> --
        >> Ignacio Machin,
        >> ignacio.machin AT dot.state.fl.us
        >> Florida Department Of Transportation
        >>
        >>
        >>
        >> "Dunc" <dunc@ntpcl.f9. co.uk> wrote in message
        >> news:uCpjtEpaFH A.3364@TK2MSFTN GP09.phx.gbl...[color=darkred]
        >>>I have a repeater that I need to display one of three different
        >>>templates, depending on a status bit in the data (e.g. if status = 0,
        >>>display a basic template, 1 = with picture, 2 = with picture + extra
        >>>text)
        >>>
        >>> Is this possible? If so, does anyone have a link to a good tutorial or
        >>> example?
        >>>
        >>> Thanks in advance,
        >>>
        >>> Duncan
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        Working...