I am trying to create an appointment template with an image and a hyperlink. I need the image and hyperlink URLs to be retrieved from custom attributes. I am currently using asp ImageButton and hyperlink controls to do this, but I am having trouble formatting the tags to retrieve the URLs.
My template is as follows:
<AppointmentTemplate>
<div>
<table id="mainTable" cellspacing="0" cellpadding="0" border="0" frame="void">
<tr>
<td width="20">
<asp:ImageButton runat="server" ID="detailsButton" ImageUrl=<%# Eval("Attributes['DetailsIconURL']") %>
AlternateText='Show Details' />
</td>
<td>
<asp:HyperLink ID='LinkButton' Font-Underline="true" ToolTip=<%# Eval("Attributes['ToolTip']") %> NavigateUrl=<%# Eval("Attributes['NavigateURL']") %>
Font-Name="Arial" runat="server" Font-Size="8pt" Font-Names="Arial,Tahoma,Verdana" Text='<%# Bind("Subject")%>'>
</asp:HyperLink>
</td>
</tr>
</table>
</div>
</AppointmentTemplate>
2 questions:
1. How do I define and set custom attributes in codebehind?
2. How do I assign the custom attribute values (URLs in this case) to control attributes in asp control tags?
I have an aspx page which dynamically loads user controls via client ajax call (.ajaxRequest(argument)). On one of the user controls in an upload control which needs full postback. I can successfully add client function to kill ajax request from user control for full postback and everything works as expected however once you load another control I get javascript error. I tried ways of removing the function on other pages, well actually the server side event AjaxRequest on aspx page.
As a work around I have to add the OnRequestStart & OnResponseEnd on the aspx page and check which page and only cancel ajax if that page and it works fine but is there a better way?
function Request(sender, args)
{
//alert('Request start initiated by: ' + args.get_eventTarget());
if (args.get_eventTarget() == "ControlsAddTrackControl$btnTrkFleUload")
{
args.set_enableAjax(false);
}
}
Regards
TRC(
"TRC").Controls.Add(AddTRCLink(TRC.Cells(x).Text, Session("IDforAcc")))
For example or
TRC.Cells(x).Controls.Add(AddTRCLink(TRC.Cells(x).Text, Session("IDforAcc")))
the AddTRCLink fucntion returns a placeholder that has vavious other contols in it. this works fine using the default gridview.
Also I am unble to even set the text property as a simple test.
Any Ideas?