Chartjs-How pass a variable from code behind to javascript

0👍

try this
define a property

protected string FilesPercentage
{
set {
ViewState["x"]=value;
}
get
{
if(ViewState["x"] != null)
return (string)ViewState["x"];
}
}

in your java script:

alert('<%=FilesPercentage%>')

in your Code Behinde:

    try
{
   int total = manager.GetAllBooks().Tables[0].Rows.Count;
   lblmsg1.Text = total.ToString();

   FilesPercentage = total.ToString();

}
catch (Exception ex)
{
   throw ex;
}

Leave a comment