Click to See Complete Forum and Search --> : WebService using Ajax control


dhakshan
05-27-2011, 08:00 AM
Hi Friends,

I am using a web service using ajax PopupControlExtender which is working in local and also in another server.The problem is the mouseover function is not working in live server. It says web service call failed 500. The following is the steps i done is any other i needs to done in webconfig file orelse some other. I checked in live server the ajax control toolkit is updated one. And i check the web method as a static one.

Aspx Page:
<asp:LinkButton ID="linkmaterial" runat="server" Text="View Details" >
</asp:LinkButton>
<cc1:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="Panel4"
TargetControlID="linkmaterial" DynamicContextKey='<%# (DataBinder.Eval(Container.DataItem, "TMED_JOB_PR_CODE")) %>'
DynamicControlID="Panel4" DynamicServicePath="PMPMaterialDetails.asmx" DynamicServiceMethod="GetDynamicContent3"
Position="Bottom">
</cc1:PopupControlExtender>

ASMX file:

<%@ WebService Language="C#" CodeBehind="~/App_Code/PMPMaterialDetails.cs" Class="PMPMaterialDetails" %>

Webservice is in APP_code folder



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Configuration;
using LNTADO;
using System.IO;
using System.Data;
using System.Text;

/// <summary>
/// Summary description for PMPMaterialDetails
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]

// 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 PMPMaterialDetails : System.Web.Services.WebService
{

public PMPMaterialDetails()
{


}

[System.Web.Services.WebMethodAttribute(),
System.Web.Script.Services.ScriptMethodAttribute()]
public static string GetDynamicContent3(string contextKey)
{
try
{
string[] arr = contextKey.Split('-');
string custommgcode = arr[0].ToString();
string jobcode = arr[1].ToString();
string strconn = ConfigurationManager.AppSettings["DBPMPConn"];
SqlConnection con = new SqlConnection(strconn);
SqlCommand cmd = new SqlCommand("[SQLPMP].[LNTSP_PMP_T_NonComposite_Custom_Material_Group_ToolTip]");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Custom_MG_Code", custommgcode);
cmd.Parameters.Add("@Job_Code", jobcode);
cmd.Connection = con;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable table = new DataTable();

da.Fill(table);

StringBuilder b = new StringBuilder();

b.Append("<table border='1' style='background-color:#f3f3f3;border: #336699 3px solid; ");
b.Append("width:45%; font-size:10pt; font-family:Verdana;' cellspacing='0' cellpadding='1'>");


b.Append("<tr style='background-color:#1C5E55;color:White;font-family:Verdana;font-size:11px;'><td rowspan='1' align='center' style='width:60%;'><b>Materials</b></td>");
b.Append("</tr>");
for (int i = 0; i < table.Rows.Count; i++)
{

b.Append("<tr>");
b.Append("<td align='center'>" + table.Rows[i]["MCMG_Description"].ToString() + "</td>");
b.Append("</tr>");
}
b.Append("</table>");

return b.ToString();
}
catch (Exception ex)
{
throw ex;
}
}

}

Will someone find an solution for this one.

ssystems
06-13-2011, 03:17 PM
Call the webservice directly and if it failed check the service