Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8515217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:05:18+00:00 2026-06-11T05:05:18+00:00

I have an arrayList in C# where i store data of ip’s and isp’s

  • 0

I have an arrayList in C# where i store data of ip’s and isp’s and count as follows from a mysql table,

ArrayList conRc = new ArrayList();

while (readIp.Read())
{
    string ipVal = readIp.GetString(0);
    string ispVal = readIp.GetString(1);
    int conLvlVal = readIp.GetInt32(2);

    conRc.Add(new ConfidenceLvl(ipVal,ispVal,conLvlVal));
}

This is my ConfidenceLvl Class,

public class ConfidenceLvl
{
    private string ip;
    private string isp;
    private int conLvl;

    public string Ip
    {
        get { return ip; }
        set { ip = value; }
    }
    public string Isp
    {
        get { return isp; }
        set { isp = value; }
    }
    public int ConLvl
    {
        get { return conLvl; }
        set { conLvl = value; }
    }

    public ConfidenceLvl(string ipVal, string ispVal, int conLvlVal) {
        this.conLvl = conLvlVal;
        this.ip = ipVal;
        this.isp = ispVal;
    }
}

I wan to pass this to javascript so that i can make use of these value to create a chart through jqPlot. Please help on this one I used this method to pass my values to javascript but it all goes as one string. I wan to take these values separately and work with them in javascript. Please help me. Thank you very much.

EDIT:
Thanks to Dominik Kirschenhofer, I finally wound up with this after successfully parsing the to javascript. May i know how to manipulate these data? like getting records 1 by 1?? i tried to but none worked,

    <asp:HiddenField ID="correlate" value= "" runat="server" />
    <script language="javascript" type="text/javascript">
        var jsonString = document.getElementById('correlate').value;
        var arr_from_json = JSON.parse(jsonString);

    </script>

The json string is as follows,

    [{"Ip":"0","Count":"10"},{"Ip":"1","Count":"11"},{"Ip":"2","Count":"12"},{"Ip":"3","Count":"13"},{"Ip":"4","Count":"14"},{"Ip":"5","Count":"15"},{"Ip":"6","Count":"16"},{"Ip":"7","Count":"17"},{"Ip":"8","Count":"18"},{"Ip":"9","Count":"19"}] 

May i know how can i work with these records 🙂

EDIT: SOLVED IT

    <asp:HiddenField ID="correlate" value= "" runat="server" />
    <script language="javascript" type="text/javascript">
        var jsonString = document.getElementById('correlate').value;
        jsonString = "{\"corrData\":" + jsonString + "}";
        var arr_from_json = JSON.parse(jsonString);
        alert(Number(arr_from_json.corrData[2].Ip)+1);
    </script>

I added corrData so that i can call it by an Integer Id like in an array. 🙂 thanks for your help guys 🙂 if there is better way..please let me know 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:05:20+00:00Added an answer on June 11, 2026 at 5:05 am

    If you are having a list or an array of fixed values in code behind which you want to use in js the easiers way is as explained in the link you have posted. Means serialize the list and store it in an hidden field. When you need to use it in js just deserialize and use it.

    Serialization see:
    http://blogs.microsoft.co.il/blogs/pini_dayan/archive/2009/03/12/convert-objects-to-json-in-c-using-javascriptserializer.aspx

    Deserialization:
    deserialize from json to javascript object

    So what do you have to do:
    1) Use a generic list.
    2) Fill the list as needed.
    3) Convert the list to an array => pretty easy using linq: myList.ToArray()
    4) Serialize the array to a json string. See 1st link.
    5) Place a hidden field on your page and set the json string as its value (code behind)
    6) Whenever you need to use this array in js, just deserialize the value of the hidden field and use it. See 2nd link.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database where I store two different kinds of data. One table
I have different objects which is used to store the data from DB in
I have created a Vector object to store data in Table object as Vector<Table>
I currently have an arraylist in C# which holds the my data base table
I have an ArrayList of HashMap like this: ArrayList<HashMap<String, String>> playListSongs = new ArrayList<HashMap<String,
I have a Arraylist List<?> myList=new ArrayList(); myList = fetchQuery(); //fetches the list of
I have the following situation: I need to save data from an Intent's putExtra
I have a text file stored in sdcard.I want to copy the data from
I have a variable declared as: private static List<String> _search_result_list = new ArrayList<String>( 15
JAVA I have an ArrayList in my game to store all the particles ingame.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.