Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. String Array written to and parsed from hidden web control

String Array written to and parsed from hidden web control

Scheduled Pinned Locked Moved C#
javascripthtmldata-structuresxmljson
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    krisp
    wrote on last edited by
    #1

    Hi there, I was wondering how I could go about writing an array of strings containing any character, into a hidden web control (textbox), and also as a parameter in a javascript function call. And not have it screw up the html on the rest of the page. Then be able to parse the one long string back into an array of strings, upon post back. The one long string can't have single quotes in it, cause it will screw up my javascrip parameter which wraps single quotes around the string. I would guess it would have to first write all the strings as one long one with some delimiter (that delimiter might already exist in the string and needs to be handled), and then convert that one big string into some kind of html compatible string not to screw up the rest of the html, or javascript parameter. Would some kind of XML work for sticking all strings into one big string? And UML or URL converter class work? Anyone have any ideas? I am hoping for some built in classes in the framework. There must be some kind of delimiter string creator class and html formatter class? I cant find any. Thanks in advance. Kris.

    H 1 Reply Last reply
    0
    • K krisp

      Hi there, I was wondering how I could go about writing an array of strings containing any character, into a hidden web control (textbox), and also as a parameter in a javascript function call. And not have it screw up the html on the rest of the page. Then be able to parse the one long string back into an array of strings, upon post back. The one long string can't have single quotes in it, cause it will screw up my javascrip parameter which wraps single quotes around the string. I would guess it would have to first write all the strings as one long one with some delimiter (that delimiter might already exist in the string and needs to be handled), and then convert that one big string into some kind of html compatible string not to screw up the rest of the html, or javascript parameter. Would some kind of XML work for sticking all strings into one big string? And UML or URL converter class work? Anyone have any ideas? I am hoping for some built in classes in the framework. There must be some kind of delimiter string creator class and html formatter class? I cant find any. Thanks in advance. Kris.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      See the HttpUtility for an HtmlDecode and HtmlEncode method. You could encode each array element, then join then with a ','. When you need the array again, split on ',' and decode each element. Fortunately, javascript also has both an encode and decode method that you could use. Works out great.

      Microsoft MVP, Visual C# My Articles

      K 1 Reply Last reply
      0
      • H Heath Stewart

        See the HttpUtility for an HtmlDecode and HtmlEncode method. You could encode each array element, then join then with a ','. When you need the array again, split on ',' and decode each element. Fortunately, javascript also has both an encode and decode method that you could use. Works out great.

        Microsoft MVP, Visual C# My Articles

        K Offline
        K Offline
        krisp
        wrote on last edited by
        #3

        Wow, thanks alot Heath. You have always been the one to asnwer all my questions, and your always right :) Well, thanks again.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups