sushma kn

sushma kn

  • NA
  • 2
  • 2.5k

Regarding jqGrid ASP.net C#

Mar 21 2014 4:56 AM
Hi I'm working in jqGrid 
I have to display jqgrid  wch is written in service library
 
 
CODES as Folllows 
 
 
$("#jqgEmpSearch").jqGrid({
url:"Servicelibrary/employeesearch.aspx?empid="+$("[id*=txtSrchEmpID]").val()+"",
datatype:"json",
colNames:['EmpNum','EmpName'], // UM_Employee_Number UM_FirstName
colModel:[
{name:'Emp Number',width:'150'},
{name:'Emp Name',width:'150'}
],
rowNum:5,
sortname:'EmpNum',
viewrecords:true,
pager:'#jqgDiv',
caption:"Employee Search Result"
});
 
 Service library code
 
I got the values from database like:  {"Table" : [{"UM_Employee_Number" : "682677","UM_FirstName" : "Sushma"}]}
 
i want in a  proper table
 
public partial class EmployeeSearch : System.Web.UI.Page
{
private User SrchUser = new User();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if ((!string.IsNullOrEmpty(Request.QueryString["empid"]))) // && (!string.IsNullOrEmpty(Request.QueryString["UM_FirstName"])))
{
SrchUser.EmployeeNo = Request.QueryString["empid"].ToString();
SrchUser.FirstName = " ";//Request.QueryString["UM_FirstName"].ToString();
TCSRR.DMTController.Users SrchContrlrObj = new TCSRR.DMTController.Users();
Response.Write(SrchContrlrObj.SearchEmp(SrchUser));
}
}
 
 
 
 Controller Code
 
 
public string SearchEmp(User SrchUser)
{
try
{
TCSRR.DMTModel.UserData SrchUserData = new TCSRR.DMTModel.UserData();
return SrchUserData.SearchEmpData(SrchUser);
}
catch (Exception ex)
{
// lstUser.Label = ex.Message;
}
return string.Empty;
}
 
 
 
 
model code
 
public String SearchEmpData(User SearchData)
{
string retVal = string.Empty;
try
{
SqlParameter[] arParms = new SqlParameter[2];
arParms[0] = new SqlParameter("@UM_Employee_Number", SearchData.EmployeeNo);
arParms[1] = new SqlParameter("@UM_FirstName", SearchData.FirstName);
retVal = SqlHelper.ExecuteJSONDataSet(FileManager.GetSettingsValue("DBConnection"), CommandType.StoredProcedure, "spmt_SearchEmployee", arParms);
if (!string.IsNullOrEmpty(retVal.Trim()) && retVal.Trim().IndexOf("Error")<=0 )
{
retVal.ToJSON();
}
}
catch (Exception ex)
{
ex.CustomException("USRSR_001", "MODEL : User Search Result failed.");
}
return retVal;
}
 
I can get the value from retVal
if i run the service library with empid ....  the table will display with correct value . but if i run the application it wont show..
could you please solve this problem