Random content

Discussion in 'ASP .Net Building Controls' started by Casper Hornstrup, Dec 17, 2003.

  1. I need to make a control that can be used like this:

    <csite:LocalizedHint id="hint1" runat="server">
    <csite:Target>
    <a href="http://whereever.net"> my text</a>
    </csite:Target>
    <csite:Source>
    <div class="special1">Click me!</div>
    </csite:Source>
    </csite:LocalizedHint>

    Target and Source should be able to contain any controls and literal
    content.
    I, however, get the following parser error:

    Type 'Localization.Target' does not have a property named 'a'.

    How do I change Target and Source to accept anything?

    Casper
    Casper Hornstrup, Dec 17, 2003
    #1
    1. Advertising

  2. Coud you use a PlaceHolder control and dynamically add a linkbutton control
    to it? You could set the URL and target properties before adding the control
    to the PlaceHolder controls collection.

    Just an idea.


    "Casper Hornstrup" <> wrote in message
    news:...
    >I need to make a control that can be used like this:
    >
    > <csite:LocalizedHint id="hint1" runat="server">
    > <csite:Target>
    > <a href="http://whereever.net"> my text</a>
    > </csite:Target>
    > <csite:Source>
    > <div class="special1">Click me!</div>
    > </csite:Source>
    > </csite:LocalizedHint>
    >
    > Target and Source should be able to contain any controls and literal
    > content.
    > I, however, get the following parser error:
    >
    > Type 'Localization.Target' does not have a property named 'a'.
    >
    > How do I change Target and Source to accept anything?
    >
    > Casper
    >
    >
    Ken Cox [Microsoft MVP], Dec 23, 2003
    #2
    1. Advertising

  3. <Source> and <Target> need to contain any valid ASP.NET tags. The a and div
    tags are just examples.

    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:#...
    > Coud you use a PlaceHolder control and dynamically add a linkbutton

    control
    > to it? You could set the URL and target properties before adding the

    control
    > to the PlaceHolder controls collection.
    >
    > Just an idea.
    >
    >
    > "Casper Hornstrup" <> wrote in message
    > news:...
    > >I need to make a control that can be used like this:
    > >
    > > <csite:LocalizedHint id="hint1" runat="server">
    > > <csite:Target>
    > > <a href="http://whereever.net"> my text</a>
    > > </csite:Target>
    > > <csite:Source>
    > > <div class="special1">Click me!</div>
    > > </csite:Source>
    > > </csite:LocalizedHint>
    > >
    > > Target and Source should be able to contain any controls and literal
    > > content.
    > > I, however, get the following parser error:
    > >
    > > Type 'Localization.Target' does not have a property named 'a'.
    > >
    > > How do I change Target and Source to accept anything?
    > >
    > > Casper
    > >
    > >

    >
    >
    Casper Hornstrup, Dec 23, 2003
    #3
  4. hi casper, what you need to do is create two templates, in your case a target and a source template. Its actually very simple, heres an example from the docs.
    what you do is define a template and child controls are in turn defined inline within this template. Dont forget to specify ParseChildren(true) on your main class. Its there on the examples

    http://samples.gotdotnet.com/quicks...tes/Template1.src&file=VB\Template1.vb&font=3

    More examples here on the main page :
    http://samples.gotdotnet.com/quicks.../quickstart/aspplus/doc/webctrlauthoring.aspx

    Those examples pretty much cover everything and all you need to know. If you having problems postback ;)
    I would have answered sooner, somehow missed this post ;P

    "Casper Hornstrup" <> wrote in message news:#...
    > <Source> and <Target> need to contain any valid ASP.NET tags. The a and div
    > tags are just examples.
    >
    > "Ken Cox [Microsoft MVP]" <> wrote in message
    > news:#...
    > > Coud you use a PlaceHolder control and dynamically add a linkbutton

    > control
    > > to it? You could set the URL and target properties before adding the

    > control
    > > to the PlaceHolder controls collection.
    > >
    > > Just an idea.
    > >
    > >
    > > "Casper Hornstrup" <> wrote in message
    > > news:...
    > > >I need to make a control that can be used like this:
    > > >
    > > > <csite:LocalizedHint id="hint1" runat="server">
    > > > <csite:Target>
    > > > <a href="http://whereever.net"> my text</a>
    > > > </csite:Target>
    > > > <csite:Source>
    > > > <div class="special1">Click me!</div>
    > > > </csite:Source>
    > > > </csite:LocalizedHint>
    > > >
    > > > Target and Source should be able to contain any controls and literal
    > > > content.
    > > > I, however, get the following parser error:
    > > >
    > > > Type 'Localization.Target' does not have a property named 'a'.
    > > >
    > > > How do I change Target and Source to accept anything?
    > > >
    > > > Casper
    > > >
    > > >

    > >
    > >

    >
    >
    Alessandro Zifiglio, Dec 23, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darren Clark

    Random NOt random?

    Darren Clark, Jun 24, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    443
    mikeb
    Jun 24, 2004
  2. Maziar Aflatoun

    Random not really random...

    Maziar Aflatoun, Aug 4, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    26,661
    Maziar Aflatoun
    Aug 5, 2004
  3. hazz
    Replies:
    6
    Views:
    49,406
    SkyUCHC
    Jun 9, 2010
  4. globalrev
    Replies:
    4
    Views:
    742
    Gabriel Genellina
    Apr 20, 2008
  5. VK
    Replies:
    15
    Views:
    1,120
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page