Home > DeveloperSection > Forums > Register javascript inside User Control using C#
Jeet Verma
Jeet Verma

Total Post:110

Posted on    August-26-2014 2:15 AM

 C# C# 

 1 Reply(s)
 998  View(s)
Rate this:

I want to call javascript function from User Control using C#. For that i am trying to use

ScriptManager.RegisterStartupScript(this, typeof(string), "alertbox", "javascript:ShowPopup('Select a row to rate');", true);

but it is not working for me.

This works fine on the page.

Can some one help me out how can i call javascript function at runtime using C#.

Sumit Kesarwani

Total Post:378

Posted on    August-26-2014 2:55 AM

Hi Jeet,

Try this.GetType() instead of typeof(string):

ScriptManager.RegisterStartupScript(this, this.GetType(), "alertbox", "ShowPopup('Select a row to rate');", true); 

Don't want to miss updates? Please click the below button!

Follow MindStick