Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

I am using JQgrid in webapplication, if i select the values from dropdown then I have to bind the jqgrid with that particular parameters,
below is the sample code :
I am calling the jqgrid in aspx page

<uc1:JqGrid runat="server" ID="JqGrid" Url="./CasteMaster.aspx/GetCasteDetails" TableName="UsersGrid" EditUrl="./CasteMaster.aspx/EditUpdateCasteDetails" Name="Caste Master" Pager="UsersGridPager" Visible="true" hideCasteGroupId="CasteGroupId" hideCasteId="CasteId" />
----calling the webmethod in aspx.cs page

[WebMethod]
[System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)]
public static CasteMasterBO GetCasteDetails()
{

try
{

CasteMasterBLL obj = new CasteMasterBLL();
return obj.getCasteData();
}
catch
{
throw;
}

}

-----calling the getcasteData method

public CasteMasterBO getCasteData()
{
DataTable dt = new DataTable();
CasteMasterBO objBO = new CasteMasterBO();
CasteMasterDAL obj = new CasteMasterDAL();
dt = obj.GetToalDt();
int pageSize = Convert.ToInt32(objBO.rows);
int limit = pageSize;
int totalPages;
int iRowCount = dt.Rows.Count;
CasteMasterBO objDeduct = new CasteMasterBO();
objDeduct.Pager = new List<castemasterbo>();
objDeduct.currpage = objBO.page;
objDeduct.totalrecords = 2000;
CasteMasterBO[] array1 = new CasteMasterBO[iRowCount];
for (int iCount = 0; iCount < iRowCount; iCount++)
{
array1[iCount] = new CasteMasterBO();
array1[iCount].CasteGroupId = dt.Rows[iCount]["CasteGroupId"].ToString();
array1[iCount].CasteGroupDesc = dt.Rows[iCount]["CasteGroupDesc"].ToString();
array1[iCount].CasteId = dt.Rows[iCount]["CasteId"].ToString();
array1[iCount].CasteDesc = dt.Rows[iCount]["CasteDesc"].ToString();



}
for (int iCount1 = 0; iCount1 < iRowCount; iCount1++)
{
objDeduct.Pager.Add(array1[iCount1]);
}
int count = array1.Length;
if (count > 0)
{
totalPages = (int)Math.Ceiling((double)2000 / limit);
}
else
{
totalPages = 0;
}
objDeduct.totalpages = totalPages;
return objDeduct;
}

from the above i am binding the jqgrid with all the values from database but my requirement is to bind the data with selected values from dropdown
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900