I have more than one user controls with the javascript functions. I set control Id to the client function – to separate it from another. My javascript code looks like:
function <%= this.ClientID %>UploadComplete(sender, args) {
....
}
And I want to register this method in the control declaration,
<ajaxToolkit:AsyncFileUpload runat="server" OnClientUploadComplete ="<%#uploaderror.ClientID%>UploadComplete"
ID="AsyncFileUpload"/>
But in mark-Up I got
{"uploadComplete":<%#ClientID%>UploadComplete},"
Where uploaderror-
I tried to use Attributes:
protected void Page_Load(object sender, EventArgs e)
{
AsyncFileUpload.Attributes.Add("OnClientUploadComplete", this.ClientID + "UploadComplete");
}
Mark-up was good. But event didn`t fire.
So I have two questions:
1) Why <%# – dont works.t fired in javascripts?
2) Why added by attributes events don
Thank you.
For your first question, the reason it doesn’t work is that you cannot mix databinding code and text in a server control’s property as you have done. It has to be one or the other. So what you could do instead is: