Skip to content Skip to sidebar Skip to footer

How To Display An Alert Box On A Non Clickable Link Button

I am having HyperLink on my webfrom in such a way that if proper user login and clicks on the link will navigate him to corresponding page. If not i make that as a non clickable f

Solution 1:

Link1.NavigateUrl = "javascript:alert('hello'); return false;";

OR

 Link1.Attributes["onclick"] = "alert('hello'); return false";

Solution 2:

In your else part add:

string prompt =
 "<script type=\"text/javascript\">alert('You are not an authorized user'); </script>";
   ClientScript.RegisterStartupScript(typeof (Page), "alert", prompt);

Regards

Post a Comment for "How To Display An Alert Box On A Non Clickable Link Button"