javascript - I get this exception when i use this script on my masterpage -


i exception when use script on masterpage

<script language="javascript" type="text/javascript">     function setsession() {'<%=session["showhjælpbox"] = "test" %>' }; </script> 

i exception when go 1 of pages have telerik component (autocompletebox) confuses me alot, please me -.-

exception: system.web.httpunhandledexception (0x80004005): der blev udløst en undtagelse af typen 'system.web.httpunhandledexception'. ---> system.web.httpexception (0x80004005): please, see whether wrapping code block, generating exception, within radcodeblock resolves error. ---> system.web.httpexception (0x80004005): samlingen controls kan ikke ændres, objektet indeholder kodeblokke (dvs. <% ... %>).    ved system.web.ui.controlcollection.add(control child)    ved telerik.web.skinregistrar.registercssreference(page page, type registertype, string url)    ved telerik.web.skinregistrar.registercssreference(page page, type registertype, string url)    ved telerik.web.skinregistrar.registercssreferences(iskinnablecontrol control)    ved telerik.web.ui.raddataboundcontrol.registercssreferences()    ved telerik.web.ui.raddataboundcontrol.controlprerender()    ved telerik.web.ui.radautocompletebox.onprerender(eventargs e)    ved system.web.ui.control.prerenderrecursiveinternal()    ved system.web.ui.control.prerenderrecursiveinternal()    ved system.web.ui.control.prerenderrecursiveinternal()    ved system.web.ui.control.prerenderrecursiveinternal()    ved system.web.ui.control.prerenderrecursiveinternal()    ved system.web.ui.control.prerenderrecursiveinternal()    ved system.web.ui.control.prerenderrecursiveinternal()    ved system.web.ui.control.prerenderrecursiveinternal()    ved system.web.ui.control.prerenderrecursiveinternal()    ved system.web.ui.control.prerenderrecursiveinternal()    ved system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint)    ved system.web.ui.page.handleerror(exception e)    ved system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint)    ved system.web.ui.page.processrequest(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint)    ved system.web.ui.page.processrequest()    ved system.web.ui.page.processrequestwithnoassert(httpcontext context)    ved system.web.ui.page.processrequest(httpcontext context)    ved asp.tidsbestilling_aspx.processrequest(httpcontext context) c:\users\cc\appdata\local\temp\temporary asp.net files\vs\6184c3c9\f93c9d53\app_web_ix30hemr.0.cs:linje 0    ved system.web.httpapplication.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute()    ved system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) 

if have way add session clicking on button please tell me, ps dont want postback on it

i not sure can read exception properly, did try wrapping server code block in radcodeblock control:

<telerik:radcodeblock runat="server" id="radcodeblock1">     <script language="javascript" type="text/javascript">         function setsession() {             '<%=session["showhjælpbox"] = "test" %>'         };     </script> </telerik:radcodeblock> 

on side note - not sure trying achieve, code render following on page:

        <script language="javascript" type="text/javascript">             function setsession() {                 'test'             };         </script> 

which not js function set server session variable. cannot in js. js runs in browser, session on server. thus, need form of postback knows session in order set on user action. perhaps blog post give ideas: http://www.telerik.com/blogs/different-ways-to-make-a-request-to-the-server.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -