I need read-access to a user-defined property of my UserControl, from within a <script>
element. This script needs to run when the user clicks on the link (which I also don't know how to setup). Thanks for your advice, SO!
Code-behind:
public partial class TNLink : System.Web.UI.UserControl
{
[System.ComponentModel.BindableAttribute(true)]
public virtual string TNImageURL { get; set; }
[System.ComponentModel.BindableAttribute(true)]
public virtual string FullImageURL { get; set; }
[System.ComponentModel.BindableAttribute(true)]
public virtual string Caption { get; set; }
}
ASP:
<script type="text/javascript">
//****How do I access the FullImageURL property for this line?****
document.getElementById('imgFull').src = FullImageURL;
</script>
<div style="text-align: center">
<a>
<asp:Image ID="imgTN" runat="server"
ImageUrl='<%# DataBinder.Eval (Page, "TNImageURL") %>'
style="border: 5px solid #000000; width: 85%;" /><br />
<asp:Label ID="lblCaption" runat="server"
Text='<%# DataBinder.Eval (Page, "Caption") %>' />
</a>
</div>