Call javascript from code behind c# sharepoint 2010 -
i have code in .ascx.cs file calls new page on href.
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 code javascript popup page change , feel.i want make page popup have written javascript method in .ascx file given below:
<script type="text/javascript"> function opendialog(url) { var newpopup = sp.ui.$create_dialogoptions(); newpopup.url = url; newpopup.width = 700; newpopup.height = 350; sp.ui.modaldialog.showmodaldialog(newpopup); } </script>
i have called javascript in code behind , not work:
lblvideoassessment.text = "<a onclick='javascript:opendialog('../sitepages/quiz.aspx')' height='300px' width='300px' target='_blank' cssclass='icondisplaycss'><img src='~/_layouts/images/assessment.png' border='none'/></a><br/>" + cat;
please advice do. same works fine sharepoint designer. please how pass javascript method on onclick.
it sounds want html assigning lblvideoassessment.text
placed in page, is. that, <asp:label ... />
not right type of control use.
instead, want <asp:literal ... />
. assignment same have:
litvideoassessment.text = "<a onclick='javascript:opendialog('../sitepages/quiz.aspx')' height='300px' width='300px' target='_blank' cssclass='icondisplaycss'><img src='~/_layouts/images/assessment.png' border='none'/></a><br/>" + cat;
Comments
Post a Comment