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

  • SEARCH
  • Home
  • 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 8863301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:56:35+00:00 2026-06-14T15:56:35+00:00

In my static web method I populate a dictionary with the Bankid and Bankname

  • 0

In my static web method I populate a dictionary with the Bankid and Bankname that I select from a database. The Id goes to the Key and the Value goes to the value part. SO there’re approximately 20 key-value-pairs in my dictionary. Then I return this dictionary to my ajax call:

      $.ajax({
            type: 'POST',
            url: 'AJAX.aspx/Banks',
            data: '',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data)
            {
                $.each(data.d, function ()
                {
                    $("#testDiv").append(this.Key + " " +this.Value + "<br/>");
                });
            },
            error: function (x, e)
            {
                alert("The call to the server side failed. " + x.responseText);
            }
        });

In the above case I get 20 rows of undefined undefined. But if I remove both .Key and .Value from this I just get the value, so bank names. I need both the key and the value because I’m going to populate a select element with them-key for value and the value for inner html.
In case you want to see my webmethod, here it is:

    [WebMethod]
public static Dictionary<string, string> Banks()
{
    Dictionary<string, string> dict = new Dictionary<string, string>();
    DatabaseProvider provider = GetDatabaseProvider();
    provider.AddOutParameter("V_CUR", OracleType.RefCursor);
    DataTable dt=provider.SelectDataTable("AGAPUS.PAYMENT.SP_BANKS", CommandType.StoredProcedure);
    foreach (DataRow row in dt.Rows)
    {
        dict.Add(row["PAYMENTTYPE"].ToString(), row["PAYMENTTYPEID"].ToString());
    }
    return dict;
}
  • 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-14T15:56:37+00:00Added an answer on June 14, 2026 at 3:56 pm

    Looks more like a question about jQuery to me. That said, try changing your success function to:

    success: function (data)
    {
        $.each(data.d, function ( key, value )
        {
            $("#testDiv").append(key + " " + value + "<br/>");
        });
    }
    

    The key and value are passed as parameters to the function when evaluating a map.

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

Sidebar

Related Questions

I have a web application where the masterPage/template contains some static HTML that never
I have a static dictionary which holds authentications for a web service. I'm running
I am hosting a web application that serves static html pages that are refreshed
I'm trying to pass parameters to my static web method (which is in an
I have a web method: [System.Web.Services.WebMethod] public static string getCharacterstics(int product_id, int lang_id) {
I have a web method, which is called from jquery's ajax method, like this:
Currently i am consuming web service from android by the method SOAP.Here i need
As PageMethods in ASP.NET need to be static methods and marked as web method,
I tried to call simple Web Method from JSON but I am getting errors.
I have a static web method which returns an object and this object has

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.