TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maneesh kasoudhan
1k
433
2.5k
Web Services is not call at the web page
Jun 27 2017 4:06 AM
This is Webservices page
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Collections.Specialized;
using System.Text.RegularExpressions;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Web.SessionState;
namespace FTSUPPRPB.WebRoot
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{
//HttpCookie getCookie = System.Web.HttpContext.Current.Response.Cookies["usermaster"];
SqlCommand cmd;
HttpCookie getCookie;
string cons = ConfigurationManager.ConnectionStrings["con"].ConnectionString;
HttpSessionState session = HttpContext.Current.Session;
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
public List<Zone> fillchart(int type)
{
SqlConnection con = new SqlConnection(cons);
List<Zone> result = new List<Zone>();
cmd = new SqlCommand("select count(newfile.fileid) as filenu ,m.firstnm from newfile newfile inner join master_employee m on m.employeeid=newfile.status group by m.firstnm", con);
con.Open();
//cmd.CommandType = CommandType.StoredProcedure;
//cmd.Parameters.AddWithValue("@qrytype", "PIS_DG_ZONE");
//cmd.Parameters.AddWithValue("@type", type);
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
Zone zn;
while (dr.Read())
{
zn = new Zone();
zn.ZoneName = dr["firstnm"].ToString();
zn.AVL = Convert.ToInt32(dr["filenu"].ToString());
//zn.ALC = Convert.ToInt32(dr["ALC"].ToString());
//zn.VAC = Convert.ToInt32(dr["VAC"].ToString());
//zn.dtvalue = dr["AVL"].ToString() + "$" + dr["ALC"].ToString() + "$" + dr["VAC"].ToString();
result.Add(zn);
}
return result;
}
public class Zone
{
public string ZoneName;
public int AVL;
}
and this is webservices1.aspx page
<%@ WebService Language="C#" CodeBehind="WebService1.asmx.cs" Class="FTSUPPRPB.WebService1" %>
This is Web.aspx Form page
<%@ Page Title="" Language="C#" MasterPageFile="~/WebRoot/banner.master" AutoEventWireup="true" CodeFile="Dashboardss.aspx.cs" Inherits="WebRoot_Dashboardss" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script src="../dashboards-js/highcharts.js" type="text/javascript"></script>
<%--<script src="../dashboard-js/modules/exporting.js" type="text/javascript"></script>--%>
<script src="../dashboards-js/modules/exporting.src.js" type="text/javascript"></script>
<script src="../dashboards-js/modules/data.js" type="text/javascript"></script>
<script src="../dashboards-js/highcharts-more.src.js" type="text/javascript"></script>
<script type="text/javascript">
var chart;
var rangechart;
var type;
var nondefchart;
var dialog;
var distdialog;
var distcastedialog;
var zonearray = [];
var Rangearray = [];
var Distarray = [];
$(function () {
// prepare an empty Highcharts object
dialog = $('#rangediv').dialog({
'autoOpen': false,
'width': 420,
'height': 350,
'closeOnEscape': true,
'modal': true
});
distdialog = $('#distdiv').dialog({
'autoOpen': false,
'width': 420,
'height': 350,
'closeOnEscape': true,
'modal': true,
'position': [300, 100]
});
distcastedialog = $('#dist_cast').dialog({
'autoOpen': false,
'width': 720,
'height': 350,
'closeOnEscape': true,
'modal': true
});
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
showAxes: true,
height: 300,
width: 300
},
title: {
text: ''
},
credits: {
text: 'DGP HQ'
},
xAxis: {
title: {
text: 'Graphical Representation Of Officers Name & File'
}
},
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
GenerateDashboardForRange(this.name);
}
}
}
}
},
yAxis: {
title: {
text: 'Amount'
}
},
tooltip: {
shared: true,
useHTML: true,
formatter: function () { return getreturnvalue(this.key, 1, zonearray); },
style: { padding: 10, color: '{series.color}' }
}
});
function getreturnvalue(name, type, arr) {
var i = 0;
var data = '';
for (i = 0; i < arr.length; i++) {
if (arr[i].split('$')[0] == name) {
if (type == 1) {
data = '<table><tr><td colspan="2" align="center"><h4> Officer Name : ' + name + "</h4></td></tr>";
//data += '<tr><td><b>Total File :</b></td><td style="color:green"><b>' + arr[i].split('$')[1] + '</b></td></tr>';
}
else if (type == 2) {
data = '<table><tr><td colspan="2" align="center"><h4> Range : ' + name + "</h4></td></tr>";
}
else {
data = '<table><tr><td colspan="2" align="center"><h4> District : ' + name + "</h4></td></tr>";
}
data += '<tr><td><b>Total File :</b></td><td style="color:blue"><b>' + arr[i].split('$')[2] + '</b></td></tr>';
data += '<tr><td><b>Total File :</b></td><td style="color:green"><b>' + arr[i].split('$')[1] + '</b></td></tr>';
data += '<tr><td><b>Vacancy :</b></td><td style="color:red"><b>' + arr[i].split('$')[3] + '</b></td></tr></table>';
return data;
}
}
}
function GenerateDashboard() {
zonearray = [];
chart.showLoading('Getting Range data please wait....');
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '../WebService1.asmx/fillchart',
data: JSON.stringify({ type: type }),
dataType: "json",
success: function (msg) {
// remove all existing series
aData = msg.d;
while (chart.series.length) {
chart.series[0].remove();
}
// re-set categories for X axe
var categories = [];
$.each(aData, function (idx, res) {
categories.push(res.ZoneName);
});
chart.xAxis[0].setCategories(categories);
chart.yAxis[0].axisTitle.attr({
text: ''
});
// gather data (percentages) and prepare a new Series array
var seriesPerData = [];
$.each(aData, function (idx, res) {
seriesPerData.push([res.ZoneName, res.AVL]);
zonearray.push(res.ZoneName + '$' + res.AVL);
});
var seriesPercentages = {
name: 'No. Of Officers',
data: seriesPerData,
type: 'pie',
size: '65%',
center: ['50%', '40%'],
showInLegend: true
}
// hide Loading, add both series and redraw our chart
chart.hideLoading();
//chart.addSeries(seriesValues, false);
chart.addSeries(seriesPercentages, false);
chart.redraw();
// GenerateDashboardForRange('LKW');
//GenerateDashboardForDistrict('LKW');
GenerateDashboardNonDef();
GenerateDashboardCaste();
},
error: Errorocr
});
}
</script>
<div id="container" style="border: 4px solid #DFDFDF;
margin: 0 auto">
<div id="rangediv" style="border: 4px solid #DFDFDF; width: 600px; height: 400px;
margin: 0 auto; display: none">
<div id="rangediv_child">
</div>
</div>
<div id="distdiv" style="border: 4px solid #DFDFDF; width: 341px; height: 300px;
margin: 0 auto; display: none">
<div id="distdiv_child">
</div>
</div>
<div id="dist_cast" style="border: 4px solid #DFDFDF; width: 341px; height: 300px;
margin: 0 auto; display: none">
<div id="dist_caste_sub">
</div>
</div>
and this web.aspx.cs page
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.Script.Services;
public partial class WebRoot_Dashboardss : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection cn;
SqlCommand cmd;
SqlDataReader dr;
SqlDataAdapter da;
DepotDetails dd = new DepotDetails();
HttpCookie getCookie;
}
[WebMethod(EnableSession = true)]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public List<Zone> fillchart()
{
List<Zone> Zone = new List<Zone>
{
new Zone{ZoneName="Audi",ZoneCount=6},
new Zone{ZoneName="Audi",ZoneCount=16},
new Zone{ZoneName="Audi",ZoneCount=50},
new Zone{ZoneName="Audi",ZoneCount=58},
new Zone{ZoneName="Audi",ZoneCount=55},
};
var query = from c in Zone select c;
return query.ToList();
}
}
public class Zone
{
public string ZoneName;
public int ZoneCount;
}
Reply
Answers (
5
)
Digest auth encrypt message always
Authentication of Web API