hi,
i have webDataGrid with checkbox.
my datagrid is populating from Search Criteria.
i can easily generate the grid. but when i check few rows in grid and trying to get those data in another search i am getting Grid.Rows.Count as -1.
here is my code:
for Search Buttoon to get Grid():
if (txtSearch.Text != "" && txtSearch.Text != null)
{false; gvPolicy.Visible = true; btnClaims.Visible = true; btnRunReport.Visible = true; SecurityUsers currentUser = ((Global)HttpContext.Current.ApplicationInstance).CurrentUser;
gvPolicy.Visible =
btnClaims.Visible =
btnRunReport.Visible =
lblComment.Visible =
if (currentUser != null)
{
List<string> profitCenterDesc = new List<string>(); SecurityUserProfitCenterService secProfitService = new SecurityUserProfitCenterService(); TList<SecurityUserProfitCenter> userProfitCntrs = secProfitService.GetBySecurityUserKey(currentUser.SecurityUserKey); if (userProfitCntrs != null && userProfitCntrs.Count > 0)
CdtProfitCenterService profitService = new CdtProfitCenterService(); foreach (SecurityUserProfitCenter userProfitCntr in userProfitCntrs)
CdtProfitCenter profitCntr = profitService.GetByProfitCenterCode(userProfitCntr.ProfitCenterCode);
profitCenterDesc.Add(profitCntr.ProfitCenterDesc);
}
if (profitCenterDesc.Count > 0)
ProfitCenterDescs = profitCenterDesc;
else
null;
{ ProfitCenterDescs =
//gvPolicy.EnsureTemplates();
MfxPolicyService policyService = new MfxPolicyService();
DataSet getPolicies = new DataSet();
getPolicies = policyService.GetPolicyGrid(dpSearch.SelectedValue.ToString(), txtSearch.Value.ToString(), chkAllPolicies.Checked);
gvPolicy.DataSource = getPolicies;
//gvPolicy.DataBind();
//gvPolicy.DataSourceID = "PolicyDataSource";
GridRecord row = new GridRecord();
CheckBox chkbox = new CheckBox();
for (int i = 0; i < gvPolicy.Rows.Count; i++)
CheckBox chk = new CheckBox(); true;
chk = FindCheckBox(gvPolicy, i);
chk.Enabled =
row = gvPolicy.Rows[i];
chkbox = FindCheckBox(gvPolicy, i);
String profitCenter = ((DataRowView)row.DataItem).Row["ProfitCenter"].ToString();
//Label lblProfitCenter = (Label)e.Row.FindControl("lblProfitCenter");
if (ProfitCenterDescs != null && ProfitCenterDescs.Contains(profitCenter)) false;
chkbox.Enabled =
} now when i select few checkboxes and try to get data the Grid.Rows.Count is -1.
code to get checked data:
List <decimal> policyRootIds = new List<decimal>(); for (int i = 0; i < gvPolicy.Rows.Count; i++) // is giving -1. GridRecord row = gvPolicy.Rows[i];
List
CheckBox chkbox = FindCheckBox(gvPolicy, i);
Infragistics.Web.UI.Framework.Data.DataRecord dr = new Infragistics.Web.UI.Framework.Data.DataRecord(gvPolicy);
if (chkbox.Checked)
decimal rootId = (decimal)(((DataRowView)row.DataItem).Row["RootId"]);
policyRootIds.Add(rootId);
if (policyRootIds.Count > 0) "PolicyRootIds"] = policyRootIds;
Session[
"PolicyRootIds"] = null;
please let me know if anyone knows about this.
Same problem here. Any comment on this?