سؤال

Good Day to All, I need to excecute a client script before OnLoggedOut event of Login status control of asp.net

I've tried to put

LoginStatus1.Attributes.Add("onclick", "javascript:limparDadosSalvamentoAutomatico();");

but it does not work.

Thanks

هل كانت مفيدة؟

المحلول

You need to override the Href attribute

LoginStatus1.Attributes["href"] = string.Format("javascript: limparDadosSalvamentoAutomatico(); __doPostBack('{0}','')", loginStatus.Controls[0].UniqueID);

نصائح أخرى

Try this:

System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "Script", "yourfunction();", True)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top