Web服务呼叫失败:500 [英] Web Service Call Failed: 500

查看:84
本文介绍了Web服务呼叫失败:500的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我遇到此错误"Web服务调用失败:500".

我正在使用AJAX PopupControlExtender,一旦将鼠标悬停在网格视图行中的图像上,就会显示一个弹出窗口.

现在,当发生鼠标悬停时,我会收到此错误.

请帮助我,因为我真的被卡住了!

谢谢

代码:

Hi,
I am having this error "Web Service Call Failed: 500".

I am using an AJAX PopupControlExtender which would show a popup once mouseover on an image in row of a grid view occurs.

Now, when mouseover occurs, i receive this error.

Please help me as i am really stuck!

Thanks

CODE:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Services;
using Sales_DAL;
using Sales_BOL;
using AjaxControlToolkit;

using System.Text;
using System.Web.Services.Description;
public partial class MCTX_Internal_SuperAdmin_frmShowDailyOutput : System.Web.UI.Page
{
    Dlayer dl = new Dlayer();
    _DailyOutput objDO = new _DailyOutput();
    _ShowDailyOutput bl = new _ShowDailyOutput();
    DataTable dt_Grid = new DataTable();
    string userid;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetEmpName();
            DataTable dtUserID = new DataTable();
            dtUserID = bl.selectuserid();
            ddlEmployees.DataSource = dtUserID;
            ddlEmployees.DataTextField = "user_id";
            ddlEmployees.DataBind();
            ddlEmployees.Items.Insert(0, "---Select---");
        }
    }
    public void GetEmpName()
    {
        string str = Session["Username"].ToString();
        DataTable dt_Name = objDO.fnGetEmpName(str);
        lblEmpName.Text = dt_Name.Rows[0]["E_Name"].ToString();
        lblEmpName.ForeColor = System.Drawing.Color.Magenta;
    }
    protected void btnShow_Click(object sender, EventArgs e)
    {
        if (FromDate.SelectedValue == null || ToDate.SelectedValue == null)
        {
            lblError.Text = "Please Select From/To Dates";
            lblError.ForeColor = System.Drawing.Color.Red;
            gvShowDailyOutput.Visible = false;
        }
        else if (ddlEmployees.SelectedItem.Text == "  ---Select---  ")
        {
            lblError.Text = "Please Select Employee";
            lblError.ForeColor = System.Drawing.Color.Red;
            gvShowDailyOutput.Visible = false;
        }
        else
        {
            DataTable dttest = new DataTable();
            dttest = Results();
            if (dt_Grid.Rows.Count > 0)
            {
                if (!IsPostBack)
                {
                }
                gvShowDailyOutput.DataSource = dt_Grid;
                gvShowDailyOutput.DataBind();
                lblError.Text = string.Empty;
                gvShowDailyOutput.Visible = true;
            }
            else
            {
                gvShowDailyOutput.Visible = false;
                lblError.Text = "No Record Found";
                lblError.ForeColor = System.Drawing.Color.Red;
            }
        }
    }
    public DataTable Results()
    {
        DateTime FrmDate = new DateTime();
        FrmDate = FromDate.SelectedDate;
        DateTime TDate = new DateTime();
        TDate = ToDate.SelectedDate;
        userid = ddlEmployees.SelectedItem.Text;
        dt_Grid = bl.selectGridData(userid, FrmDate, TDate);
        return dt_Grid;
    }
    protected void gvShowDailyOutput_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvShowDailyOutput.PageIndex = e.NewPageIndex;
        Results();
        gvShowDailyOutput.DataSource = dt_Grid;
        gvShowDailyOutput.DataBind();
    }
    protected void gvShowDailyOutput_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            PopupControlExtender pce = e.Row.FindControl("PopupControlExtender1") as PopupControlExtender;
            string behaviorID = "pce_" + e.Row.RowIndex;
            pce.BehaviorID = behaviorID;
            Image img = (Image)e.Row.FindControl("Image1");
            string OnMouseOverScript = string.Format("$find(''{0}'').showPopup();", behaviorID);
            string OnMouseOutScript = string.Format("$find(''{0}'').hidePopup();", behaviorID);
            img.Attributes.Add("onmouseover", OnMouseOverScript);
            img.Attributes.Add("onmouseout", OnMouseOutScript);
        }
    }
    [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
    public static string GetDynamicContent(string DynamicContextKey)
    {
        DropDownList ddlEmployees = new DropDownList();
        StringBuilder b = new StringBuilder();
        DataTable table = new DataTable();
        _ShowDailyOutput sdo = new _ShowDailyOutput();
        table = sdo.selectPopupData(ddlEmployees.SelectedItem.Text, DynamicContextKey);
        b.Append("<table style=''background-color:#f3f3f3; border: #336699 3px solid; ");
        b.Append("width:350px; font-size:10pt; font-family:Verdana;'' cellspacing=''0'' cellpadding=''3''>");
        b.Append("<tr><td colspan=''3'' style=''background-color:#336699; color:white;''>");
        b.Append("<b>Report Details</b>"); b.Append("</td></tr>");
        b.Append("<tr><td style=''width:80px;''><b>Hour No</b></td>");
        b.Append("<tr><td style=''width:80px;''><b>From Time</b></td>");
        b.Append("<tr><td style=''width:80px;''><b>To Time</b></td>");
        b.Append("<tr><td style=''width:80px;''><b>Report Time</b></td>");
        b.Append("<tr><td style=''width:80px;''><b>Activity</b></td>");
        b.Append("<tr>");
        b.Append("<td>$" + table.Rows[0]["hourNo"].ToString() + "</td>");
        b.Append("<td>" + table.Rows[0]["fromTime"].ToString() + "</td>");
        b.Append("<td>" + table.Rows[0]["rptTime"].ToString() + "</td>");
        b.Append("<td>" + table.Rows[0]["TaskDetails"].ToString() + "</td>");
        b.Append("</tr>");
        b.Append("</table>");
        return b.ToString();
    }

}
public class _ShowDailyOutput
{
    Dlayer dl = new Dlayer();
    string query;
    public DataTable selectuserid()
    {
        DataTable dt = new DataTable();
        query = "select user_id from user1";
        dt = dl.DA_getTable(query);
        return dt;
    }
    public DataTable selectGridData(string UserID, DateTime FrmDate, DateTime TDate)
    {
        DataTable dt = new DataTable();
        query = "select CONVERT(varchar(20),currentdate,101) AS CurrentDate ,DailyReport.DailyReport_ID, DailyReport.MyOutput from DailyReport INNER JOIN ReportDetails on ReportDetails.DailyReport_ID = DailyReport.DailyReport_ID where user_id = ''" + UserID + "'' and CurrentDate between ''" + FrmDate + "'' and ''" + TDate + "''";
        dt = dl.DA_getTable(query);
        return dt;
    }
    public DataTable selectPopupData(string ReportID, string ContextKey)
    {
        string query;
        Dlayer dl = new Dlayer();
        DataTable dt = new DataTable();
        query = "select ReportDetails.hourNo, ReportDetails.fromtime, ReportDetails.toTime, ReportDetails.rptTime, ReportDetails.TaskDetails from ReportDetails Inner Join DailyReport on ReportDetails.DailyReport_ID = DailyReport.DailyReport_ID where DailyReport.DailyReport_ID = ''" + ReportID + "'' and user_id = ''" + ContextKey + "''";
        dt = dl.DA_getTable(query);
        return dt;
    }
}

推荐答案

find(''{0}'').showPopup();,behaviorID); 字符串OnMouseOutScript = string.Format("
find(''{0}'').showPopup();", behaviorID); string OnMouseOutScript = string.Format("


find(''{0}'').hidePopup();",behaviorID); img.Attributes.Add("onmouseover",OnMouseOverScript); img.Attributes.Add("onmouseout",OnMouseOutScript); } } [System.Web.Services.WebMethodAttribute(),System.Web.Script.Services.ScriptMethodAttribute()] 公共静态字符串GetDynamicContent(string DynamicContextKey) { DropDownList ddlEmployees = new DropDownList(); StringBuilder b =新的StringBuilder(); DataTable表=新的DataTable(); _ShowDailyOutput sdo = new _ShowDailyOutput(); table = sdo.selectPopupData(ddlEmployees.SelectedItem.Text,DynamicContextKey); b.Append(< table style ="''background-color:#f3f3f3; border:#336699 3px solid;); b.Append("width:350px; font-size:10pt; font-family:Verdana;''cellspacing =''0''cellpadding =''3''>")); b.Append(< tr>< td colspan =''3''style =''background-color:#336699; color:white;''>"); b.Append(< b>报告详细信息</b>"); b.Append("/td>//tr"); b.Append(< tr> td style =''width:80px;''< b>小时编号</b</td>"); b.Append(< tr> td style =''width:80px;''< b> From Time</b</td>"); b.Append(< tr> td style =''width:80px;''< b>到时间</b</td>); b.Append(< tr> td style =''width:80px;''< b>报告时间</b</td>"); b.Append(< tr> td style =''width:80px;''< b>活动</b</td>"); b.Append(< tr>"); b.Append(< td>
find(''{0}'').hidePopup();", behaviorID); img.Attributes.Add("onmouseover", OnMouseOverScript); img.Attributes.Add("onmouseout", OnMouseOutScript); } } [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()] public static string GetDynamicContent(string DynamicContextKey) { DropDownList ddlEmployees = new DropDownList(); StringBuilder b = new StringBuilder(); DataTable table = new DataTable(); _ShowDailyOutput sdo = new _ShowDailyOutput(); table = sdo.selectPopupData(ddlEmployees.SelectedItem.Text, DynamicContextKey); b.Append("<table style=''background-color:#f3f3f3; border: #336699 3px solid; "); b.Append("width:350px; font-size:10pt; font-family:Verdana;'' cellspacing=''0'' cellpadding=''3''>"); b.Append("<tr><td colspan=''3'' style=''background-color:#336699; color:white;''>"); b.Append("<b>Report Details</b>"); b.Append("</td></tr>"); b.Append("<tr><td style=''width:80px;''><b>Hour No</b></td>"); b.Append("<tr><td style=''width:80px;''><b>From Time</b></td>"); b.Append("<tr><td style=''width:80px;''><b>To Time</b></td>"); b.Append("<tr><td style=''width:80px;''><b>Report Time</b></td>"); b.Append("<tr><td style=''width:80px;''><b>Activity</b></td>"); b.Append("<tr>"); b.Append("<td>


" + table.Rows [0] ["hourNo"].ToString()+</td>"); b.Append(< td>" + table.Rows [0] ["fromTime"].ToString()+</td>")); b.Append(< td>" + table.Rows [0] ["rptTime"].ToString()+</td>")); b.Append(< td>" + table.Rows [0] ["TaskDetails"].ToString()+</td>")); b.Append(</tr>"); b.Append(</table>"); 返回b.ToString(); } } 公共类_ShowDailyOutput { Dlayer dl =新的Dlayer(); 字符串查询; 公共数据表selectuserid() { DataTable dt = new DataTable(); 查询=从用户1中选择用户ID"; dt = dl.DA_getTable(query); 返回dt } 公用DataTable selectGridData(字符串UserID,DateTime FrmDate,DateTime TDate) { DataTable dt = new DataTable(); 查询=从CONVERT(varchar(20),currentdate,101)AS CurrentDate,DailyReport.DailyReport_ID,DailyReport.MyOutput从DailyReport内加入ReportDetails上的ReportDetails.DailyReport_ID= DailyReport.DailyReport_ID,其中user_id =""+ UserID +"以及介于" + FrmDate +"与" + TDate +''"之间的CurrentDate; dt = dl.DA_getTable(query); 返回dt } 公共数据表selectPopupData(字符串ReportID,字符串ContextKey) { 字符串查询; Dlayer dl =新的Dlayer(); DataTable dt = new DataTable(); 查询=从ReportDetails中选择ReportDetails.hourNo,ReportDetails.fromtime,ReportDetails.toTime,ReportDetails.rptTime,ReportDetails.TaskDetails.在ReportDetails.DailyReport_ID = DailyReport.DailyReport_ID上加入DailyReport,其中DailyReport.DailyReport_ID =""+ ReportID +"''和user_id =''"+ ContextKey +"''; dt = dl.DA_getTable(query); 返回dt } }
" + table.Rows[0]["hourNo"].ToString() + "</td>"); b.Append("<td>" + table.Rows[0]["fromTime"].ToString() + "</td>"); b.Append("<td>" + table.Rows[0]["rptTime"].ToString() + "</td>"); b.Append("<td>" + table.Rows[0]["TaskDetails"].ToString() + "</td>"); b.Append("</tr>"); b.Append("</table>"); return b.ToString(); } } public class _ShowDailyOutput { Dlayer dl = new Dlayer(); string query; public DataTable selectuserid() { DataTable dt = new DataTable(); query = "select user_id from user1"; dt = dl.DA_getTable(query); return dt; } public DataTable selectGridData(string UserID, DateTime FrmDate, DateTime TDate) { DataTable dt = new DataTable(); query = "select CONVERT(varchar(20),currentdate,101) AS CurrentDate ,DailyReport.DailyReport_ID, DailyReport.MyOutput from DailyReport INNER JOIN ReportDetails on ReportDetails.DailyReport_ID = DailyReport.DailyReport_ID where user_id = ''" + UserID + "'' and CurrentDate between ''" + FrmDate + "'' and ''" + TDate + "''"; dt = dl.DA_getTable(query); return dt; } public DataTable selectPopupData(string ReportID, string ContextKey) { string query; Dlayer dl = new Dlayer(); DataTable dt = new DataTable(); query = "select ReportDetails.hourNo, ReportDetails.fromtime, ReportDetails.toTime, ReportDetails.rptTime, ReportDetails.TaskDetails from ReportDetails Inner Join DailyReport on ReportDetails.DailyReport_ID = DailyReport.DailyReport_ID where DailyReport.DailyReport_ID = ''" + ReportID + "'' and user_id = ''" + ContextKey + "''"; dt = dl.DA_getTable(query); return dt; } }


这篇关于Web服务呼叫失败:500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆