javascript - Exposing server-side state through client-side controls in ASP.net -


hopefully isn't redundant question--i'm not sure how word it. let's have list of items on asp.net page. list selectable in whenever user clicks on one, page postback , server code stores index or unique identifier of picture in viewstate property indicating selected.

i minimize load on server , therefore store index or unique identifier representing image in way on client side. best way can think store said information in hidden field ), had 2 questions before go crazy:

  1. is security risk in way, shape or form (i.e., exposing implementation details of page)?

  2. is there better/best way more industry-standard? asp.net provide framework cleaner idea? seems common requirement me...

i have been working in asp.net 2 years now. please, kind :-)

best, patrick kozub

  1. the security risk if list items must remain non-selectable. sounds not case in situation. user knows information, because or selected item.

    note: if server ever information , pulls user, must validate index value. otherwise, user change invalid index, such (-2), , trigger exception.

  2. you can store index (or related value) in global javascript variable. if you're avoiding trip server, .net doesn't have role play.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -