same custom control on page, doesn't work

Discussion in 'ASP .Net Web Controls' started by Tim, Jul 19, 2004.

  1. Tim

    Tim Guest

    I have a custom control. When I place one inside a repeater it works.

    I'm trying to place two inside the repeater but it is not working. The
    control accepts an attribute of LinkText which displays the text the
    user clicks on for the link.

    When the LinkText is dynamic, ie received from the datasource, it
    works fine. However, the other control I'm trying to have the LinkText
    be N or some other letter/word that will always be the same.

    Here is the code for LinkText in my control:

    public string LinkText
    {
    get
    {

    return this.ViewState[this.ClientID + "LinkText"] != null ?
    (string)this.ViewState[this.ClientID + "LinkText"] : string.Empty;

    }

    set
    {
    this.ViewState[this.ClientID + "LinkText"] = value;

    }
    }

    It's outputting:
    output.Write("<a href=\"javascript:" +
    Page.GetPostBackEventReference(this) + "\">" + LinkText + "</a>");

    and here are the two calls to the control from the repeater:

    <Custom:WebCustomControl1 NavigateURL="Solution.aspx" OriginID='<%#
    DataBinder.Eval(Container.DataItem, "OriginID") %>' KSPSolutionID='<%#
    DataBinder.Eval(Container.DataItem, "KSPSolutionID") %>' LinkText='N'
    OnClick="Solution_Click" id="webcustomcontrol"
    runat="server"></Custom:WebCustomControl1>

    <Custom:WebCustomControl1 NavigateURL="Solution.aspx" OriginID='<%#
    DataBinder.Eval(Container.DataItem, "OriginID") %>' KSPSolutionID='<%#
    DataBinder.Eval(Container.DataItem, "KSPSolutionID") %>' LinkText='<%#
    DataBinder.Eval(Container.DataItem, "SolutionTitle") %>'
    OnClick="Solution_Click" id="webcustomcontrol"
    runat="server"></Custom:WebCustomControl1>

    The link for the first control does not display N but the second one
    works. I looked at the source code and it is creating both links, just
    not the text to click on for the first one.

    Any help is appreciated.

    -Tim
     
    Tim, Jul 19, 2004
    #1
    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. Dan
    Replies:
    1
    Views:
    5,414
    Christophe Gijbels
    Jan 4, 2004
  2. David Hubbard
    Replies:
    2
    Views:
    838
    David Hubbard
    Jan 12, 2006
  3. Matt Sokol
    Replies:
    2
    Views:
    395
    Theo Tillotson
    Aug 7, 2003
  4. Larry Woods
    Replies:
    16
    Views:
    359
    Aaron [SQL Server MVP]
    Jul 11, 2004
  5. rigo
    Replies:
    0
    Views:
    175
Loading...

Share This Page