Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Explanation:

I have an grid view which contains RepositoryItemCheckEdit column's and RepositoryItemTextEdit column's,grid view contains column's like Item Id, Bar code,Pack Id etc

1)RepositoryItemCheckEdit

Same Item Id and bar code can come multiple items in grid view with different pack id.

What I need is, if user selects any one item id's check box in grid view means i need all associated check box row's to be checked or unchecked viceversa. User may select either first check box or last check box then associated check box need to be checked or unchecked viceversa based upon user selection

2)RepositoryItemTextEdit

Same as like check box Column Edit,Text edit Column Edit need to be worked such as if user enters 100 in item id column cell value means then corresponding Item id row's should also be assigned as 100 as follows

void repchkCheckbox_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
{
DataTable dt_check = new DataTable();
dt_check = (DataTable)gcItemMaster.DataSource;
Int64 sItemId = Convert.ToInt64(gvItemMaster.GetRowCellValue(gvItemMaster.FocusedRowHandle, gvItemMaster.Columns["ItemID"]));
bool bDiscount = Convert.ToBoolean(e.Value);
int iItemcount = (from DataRow row in dt_check.Rows where (string)row["ItemID"] == "1" select row).Count();
int iRowHandle = gvItemMaster.FocusedRowHandle;
for (int i = 0; i < iItemcount; i++)
{
if (bDiscount)
gvItemMaster.SetRowCellValue(iRowHandle, gvItemMaster.Columns["AllowDiscount"], true);
else
gvItemMaster.SetRowCellValue(iRowHandle, gvItemMaster.Columns["AllowDiscount"], false);

iRowHandle++;
}
}
Illustrative Purpose : if i contains 5 rows in gridview with same itemid but different packid... if i check very first row checkbox of itemId means i can easily able to populate remaining checkbox like 2nd,3rd,4th,5th through increamenting rowhandle value But My Question is if suppose i check 3 row of gridview Itemid checkbox means i can able to populate only 4th and 5th row of checkbox state..but 1st and 2nd row remains the same...
Posted
Comments
BillWoodruff 31-Oct-14 12:59pm    
I always wonder why someone who has purchased an expensive software package, like DevXpress, is not posting technical questions that may requite detailed knowledge of the specific software on the forums provided by the company for programmers.

However, I don't object to your posting the question here, and I hope you get help with it.

1 solution

I Found the Solution It's works Perfectly:

Int64 iItemId = Convert.ToInt64(gvItemMaster.GetRowCellValue(e.RowHandle, "ItemID"));
bool bDiscount = Convert.ToBoolean(e.Value);

for (int i = 0; i < gvItemMaster.DataRowCount; i++)
{
Int64 id = Convert.ToInt64(gvItemMaster.GetRowCellValue(i, "ItemID"));
if (id == iItemId)
{
if (bDiscount)
gvItemMaster.SetRowCellValue(i, gvItemMaster.Columns[""+sColumn.Replace(" ","")+""], true);
else
gvItemMaster.SetRowCellValue(i, gvItemMaster.Columns[""+sColumn.Replace(" ","")+""], false);
}
}
 
Share this answer
 

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