sharepoint - Call Javascript method from code behind c# -
please me solve challenge:( have below code:
label lblvideoassessment = new label(); lblvideoassessment.text = "<a href='../sitepages/assessment.aspx?cat=" + cat + "' height='300px' width='300px' target='_blank' cssclass='icondisplaycss'><img src='~/_layouts/images/assessment.png' border='none'/></a><br/>" + cat;
i want replace above code dialogue box instead of opening new page "Ässessment.aspx". have tried this:
lblvideoassessment.text = "<a cssclass='icondisplaycss' width='300px' height='300px' onclick='javascript:opendialog('../sitepages/assessment.aspx?cat='+cat+);return false;'><img border='none' src='~/_layouts/images/assessment.png'></a>";
however doesnot work. think issue ''
(quotation have placed ) or need use page.clientscript.registerstartupscript
if yes...how , place it?
please have been struggling fort night.
i had got suggestion use literal control.i have tried , not work.
var strscript = "<script language=\"javascript\" type=\"text/javascript\">"; strscript += "alert(\"hello\")"; strscript += "</script>"; page.clientscript.registerclientscriptblock(gettype(), "onload", strscript, false);
good luck!
edit:
var script = "<script language=\"javascript\" type=\"text/javascript\">$('#tag').click(function () {})</script>"; page.clientscript.registerclientscriptblock(gettype(), "ready", script , false);
finally:
var script = "<script language=\"javascript\" type=\"text/javascript\">$(\".icondisplaycss\").click(function () {opendialog('../sitepages/assessment.aspx?cat='" + cat + "); });</script>" page.clientscript.registerclientscriptblock(gettype(), "ready", script , false);
Comments
Post a Comment