내 프로젝트에 FlexiGid를 사용하고 있습니다. 그러나 문제는 WebMethod가 실행되지 않습니다. (Json/Ajax 호출) Webmethod에 디버그 지점을 넣었지만 실행 중이 아니며 방화 광구가 웹 메소드 URL이 맞습니다. 여기FlexiGrid에서 웹 메서드가 실행되지 않음
내가 코드
아약스 전화가 방화범 후
function flexgrid() {
debugger;
$("#flex1").flexigrid({
url: '/WebMethods.aspx/GetIssueSummaryById',
dataType: 'json',
contentType: "application/json; charset=utf-8",
colModel : [
{display: 'ID', name : 'id', width : 40, sortable : true, align: 'center'},
],
data: JSON.stringify({ ProjectId: "1", UserId: "1" }), //Hard code this values at this time
buttons : [
{ name: 'Add', bclass: 'add', onpress: test },
{ name: 'Delete', bclass: 'delete', onpress: test },
{separator: true},
{name: 'A', onpress: sortAlpha},
{name: 'B', onpress: sortAlpha}
],
searchitems : [
{ display: 'Project', name: 'project' },
{display: 'Name', name : 'name', isdefault: true}
],
sortname: "id",
sortorder: "asc",
usepager: true,
title: 'Issue Summary',
useRp: true,
rp: 10,
showTableToggleBtn: true,
width: 1000,
height: 500
});
};
웹 방법 (WebMethods.aspx 파일에 먹으 렴)
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static List<IssuesVM> GetIssueSummaryById(string UserId, string ProjectId)
{
//Guid LoggedInUserId = new Guid(UserId);
//int ProjectId = Convert.ToInt32(ProjectId);
List<IssuesVM> lst = new List<IssuesVM>();
try
{
SqlCommand comIssueSummary = new SqlCommand("SP_GetIssuesByProjectIDAndOwnerId", conn);
comIssueSummary.CommandType = CommandType.StoredProcedure;
//comIssueSummary.Parameters.Add("@ProjectId", SqlDbType.Int).Value = ProjectId;
// comIssueSummary.Parameters.Add("@UserId", SqlDbType.UniqueIdentifier).Value = LoggedInUserId;
if (conn.State == ConnectionState.Closed)
conn.Open();
SqlDataReader rdr = comIssueSummary.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(rdr);
foreach (DataRow r in dt.Rows)
{
//Some code goes here
}
}
catch (Exception)
{
throw;
}
return lst;
}
을이 Image Here
보여줍니다 뒀다누구든지 th에 대한 오류를 알 수 있습니까? 뭐야? 웹 방식을 발사하지 않습니까?
P.S - 아래 게시물 [Click Here]에서 몇 가지 해결책을 보았습니다. 나는 flexigrid.js 파일을 보냈지 만 작동하지 않습니다. 여기
는 이동하는 것이 좋습니다 수 있습니다 오프 그래서 일단$.ajax({
contentType: "application/json; charset=utf-8",
data: "{}", // to pass the parameters to WebMethod see below
success: function (data) {
g.addData(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
try {
if (p.onError) p.onError(XMLHttpRequest, textStatus, errorThrown);
} catch (e) {}
}
});
},