Last post Oct 31, 2008 05:19 AM by ono
Aug 12, 2007 05:41 PM|PaulTAG|LINK
I have been working on my first custom databound templated control. Everything works well, and I have data being bound to the control and the template being created and used correctly. My control is an enhanced Calendar control, and the template enables
me to render event details to the day table cells when the DayRender event fires.
Everything is working as expected, except for 1 small thing. If I place a LinkButton inside my template, the resulting rendered link has no href attribute. So in my html I have the following to specify the template
<asp:Button runat="server" ID="button1" Text="Click Me" />
<asp:LinkButton runat="server" ID="eventDetails" OnClick="eventClick_clicked">
<%# DataBinder.Eval(Container.DataItem, "EventHeader")%>
<%# DataBinder.Eval(Container.DataItem, "EventDescription")%>
The calendar renders out fine, and the data binding expressions are evaluated correctly. However the LinkButton is rendered as
<a id="eventDetails">Blah Blah Blah</a>
ie, no href attribute and no postback raised when you click on it.
Do I need to do something specific when handling my custom iTemplate in order to render the href attribute with the correct __dopostback and postback options?
Thanks for your help
Aug 14, 2007 05:54 AM|sujitm|LINK
Try adding HREF in the attribute of the LinkButton in code behind in ItemDataBound event or something. Like below:
Oct 31, 2008 05:19 AM|ono|LINK
Have you managed to fix this ? I'm having the same problem - there's something wrong i'm doing for sure.