same custom control on page, doesn't work

T

Tim

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,264
Messages
2,571,065
Members
48,770
Latest member
ElysaD

Latest Threads

Top