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 8021663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:03:09+00:00 2026-06-04T22:03:09+00:00

please some one help to clear this error I want to show a modal

  • 0

please some one help to clear this error

I want to show a modal pop(with inside details from database) upon each click of the dynamic boxes without page refresh.I used jquery ajax,but i cant get the values from database.it shows undefined error on the field inside pop up.please see the code.

<script type="text/javascript">
      $.fx.speeds._default = 1000;
      $(document).ready(function () {
          $("div[id*='window']").live('click', function (e) {
              $.ajax({
                  url: 'Default2.aspx/get_details',
                  type: 'Get',
                  // dataType: 'json',
                  data: { id: $(this).attr('id').replace(/window/g, '') },
                  success: function (data) {
                    alert(data);
                      $('<div></div>').appendTo('body').html('<div>' + data.comp_name + '</div><div>' + data.comp_status + '</div>').dialog({
                          modal: true, title: 'owner details', zIndex: 10000, autoOpen: true,
                          width: 400, height: 200, modal: false, resizable: false, closeOnEscape: false,
                          show: "slide", hide: "explode",

                          close: function (event, ui) {
                              $(this).remove();
                          }
                      });
                  }
              });
          });
      });


  </script>

c# code:

public class Company
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Status { get; set; }
    }


  public Company get_details(int id)
  {

      DataSet dset = new DataSet();
      SqlConnection cn = new SqlConnection(@"Data Source=KUR;Initial Catalog=Drea;User ID=sa;Password=Sage");
      string qry = "Select comp_companyId,comp_name,comp_status from Company where comp_companyId=" +id+" ";
      SqlDataAdapter sda = new SqlDataAdapter(qry, cn);
      sda.Fill(dset);

      Company entity = new Company();

      SqlCommand cmd = new SqlCommand(qry, cn);

      SqlDataReader reader = cmd.ExecuteReader();

      if (reader.Read())
      {
          entity.Id = int.Parse(reader["comp_companyId"].ToString());
          entity.Name = reader["comp_name"].ToString();
          entity.Status = reader["comp_status"].ToString();
      }

      return entity;
  }
  • 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-04T22:03:11+00:00Added an answer on June 4, 2026 at 10:03 pm
    public string Name { get; set; } -> data.Name ...
    if u use data.name it will show as undefined. because it is case sensitive   
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <link href="Scripts/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet"
            type="text/css" />
        <script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
        <script src="Scripts/jquery-ui-1.8.20.custom.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $.fx.speeds._default = 1000;
            $(document).ready(function () {
                $("div[id*='window']").live('click', function (e) {
                    $.ajax({
                        url: "WebService.asmx/GetCompanyDetails", type: "Post", dataType: "json",
                        data: JSON.stringify({ id: $(this).attr('id').replace(/window/g, '') }),
                        contentType: "application/json; charset=utf-8",
                        success: function (msg) {
                            var data = $.parseJSON(JSON.stringify(eval("(" + msg.d + ")")));
    
                            $('<div></div>').appendTo('body').html('<div>' + data.Name + '</div><div>' + data.City + '</div>').dialog({
                                modal: true, title: 'Test message', zIndex: 10000, autoOpen: true,
                                width: 460, height: 300, modal: true, resizable: false, closeOnEscape: false,
                                show: "slide", hide: "explode",
                                buttons: {
                                    Ok: function () {
                                        $(this).dialog("close");
                                    }
                                },
                                close: function (event, ui) {
                                    $(this).remove();
                                }
                            });
                        },
                        error: function (msg) {
    
                        }
                    });
                });
            });
        </script>
    </head>
    <body>
        <div id="window1">
            Test1
        </div>
        <br />
        <br />
        <br />
        <br />
        <div id="window2">
            Test2
        </div>
    </body>
    </html>
    
    
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Entity;
    
    namespace CompanyDisplay
    {
        public partial class CompayJqueryUI : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
    
            public Company GetCompanyDetails(int id)
            {
                if (true)   //authorize 
                {
                    //SqlConnection cn = new SqlConnection(@"Data Source=KURIOS_WS4;Initial Catalog=Dreams;User ID=sa;Password=SageCRMv71");
                    //string qry = "Select comp_companyId,comp_name,comp_status from Company where comp_companyId=@comp_companyId ";
                    //SqlCommand cmd = new SqlCommand(qry, cn);
                    //SqlDataReader reader = cmd.ExecuteReader();
    
                    Company entity = new Company();
                    entity.Id = 2;
                    entity.Name = "Test";
                    entity.City = "Bangalore";
    
                    //Or
    
                    //if (reader.Read())
                    //{
                    //    entity.Id = int.Parse(reader["comp_companyId"].ToString());
                    //    entity.Name = reader["comp_name"].ToString();
                    //    entity.City = reader["comp_status"].ToString();
                    //}
    
                    return entity;
                }
                else
                {
                    return new Company();
                }
            }
        }
    }
    
    
    
    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.Services;
    using System.Web.Script.Services;
    using System.Web.Script.Serialization;
    using CompanyDisplay;
    
    namespace CompanyDisplay
    {
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        [ScriptService]
        public class WebService : System.Web.Services.WebService
        {
            [WebMethod]
            [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
            public string GetCompanyDetails(int id)
            {
                return new JavaScriptSerializer().Serialize(new CompayJqueryUI().GetCompanyDetails(id));
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can any one please help me solve this. I am resizing some flash object/embed
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
can someone please help me. why does this return an error: Dim stuff As
Im getting angry with this error and cannot solve it. Please, some Jedi master
Im a beginner to css, please can someone help me get this element to
Could someone please help me in here, I'm just a beginner who want to
Can someone please help me out with a JavaScript/jQuery solution for this arithmetic problem:
Please, help me clear my mind on the following question. Recently I asked a
I need some help with C++, please! I'm writing a command parser for a
I will try to make this as clear as I can. Please let me

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.