asp.net - using VB.NET Shared Property in inline-code: `<% =<property> %>` -


i'm using shared property add text div.

step of procedure is:

  1. define shared property submitted= "not submitted" in myclass.vb .
  2. create mymasterpage.master div: <div><%=submited%></div>

  3. create page1.aspx code-behind:

    protected sub page_load (...) if action="submitted" submitted="submitted" end if end sub 

so far, fine, problem when master loads again , submited keeps value , show:

<div>submitted</div>

i need 1 time specified submitted "submitted" ,next time submited called, returns "not submited" (i.e. it's orginal value)

<div>not submitted</div>

don't use shared variable or property this.

a shared (static in c#) variable shared across users of web application. imagine 2 users , b accessing web site @ same moment. doing cause user see supposed user b, , vice versa. wouldn't want that, you?

the solution simple: don't make property shared. if have trouble accessing instance (= non-shared) property within code, suggest open separate question on that. making property shared not solution.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -