We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Get Updated grid values

Hi
I have four checkbox column in grid, i am binding grid on SelectedIndexChanged event of dropdownlist. after binding grid i change some values of check boxes which are in now i want this updated values of grid in SelectedIndexChanged event of dropdownlist so that i can save those values ...
How can i achive this ?

3 Replies

HT Harshad Teli September 3, 2009 07:21 AM UTC

i want all grid details with updated records....
currently i am using following code but it brings me grid data with old values

UserRight objUserRight;
List lstUserFunctions = new List();

if (grdFunctionList.Table.Records.Count > 0)
{
foreach (Syncfusion.Grouping.Record obj in grdFunctionList.Table.Records)
{
objUserRight = new UserRight();
objUserRight.FunctionGroup = Convert.ToString(obj.GetValue("FunctionGroup"));
objUserRight.FunctionName = Convert.ToString(obj.GetValue("FunctionName"));
objUserRight.SystemFunctionID = Convert.ToInt32(obj.GetValue("SystemFunctionID"));
objUserRight.SystemFunctionGroupID = Convert.ToInt32(obj.GetValue("SystemFunctionGroupID"));
objUserRight.Access = Convert.ToBoolean(obj.GetValue("Access"));
objUserRight.Create = Convert.ToBoolean(obj.GetValue("Create"));
objUserRight.Edit = Convert.ToBoolean(obj.GetValue("Edit"));
objUserRight.View = Convert.ToBoolean(obj.GetValue("View"));
objUserRight.Delete = Convert.ToBoolean(obj.GetValue("Delete"));
lstUserFunctions.Add(objUserRight);
}

}


HT Harshad Teli September 7, 2009 06:53 AM UTC

hi,


incase new record is added to the dropdown list within the Syncfusion grid i am unable to get the current record of the dropdown as at this point grid has 0 records for these reason the grid controls(drop down) is not found and its value is b=null

how do i get the selected value of the dropdown ..


MW Melba Winshia Syncfusion Team September 16, 2009 12:54 PM UTC

Hi Harshad,

Thank you for your interest in Syncfusion Products.

You can get the updated grid values and the selected value of dropdownlist in GridRowEditUpdateLink onclick event of GridGroupingControl. Please refer below code snippet to achieve this:

protected void GridRowEditUpdateLink1_OnClick(object sender, GridRowEditUpdateEventArgs e)
{
Label1.Text = "";
switch (e.CommandLinkType)
{
case "Update":
DropDownList dropdown = null;
foreach (TableRow row in this.GridGroupingControl1.TopLevelTable.Rows)
{
if (row is GridRow)
{
GridRow gridRow = row as GridRow;
if (gridRow.Record != null)
{
Record record = gridRow.Record;
foreach (GridCell gridCell in gridRow.Cells)
{
if (gridCell.ColumnDescriptor.HeaderText == "Reference Data 1")
{
foreach (Control cntl in gridCell.Controls[0].Controls)
{
if (cntl is DropDownList)
{
dropdown = cntl as DropDownList;
GridCellTemplated grid = (GridCellTemplated)dropdown.Parent.Parent;
//To retrieve the updated values
//Label1.Text += gridRow.Record.GetValue("Id") + "--" + gridRow.Record.GetValue("Name") + "--" + dropdown.SelectedValue + "
";
}
}
}
}
}
}
}
e.CurrentRecord.SetValue("Collections", dropdown.SelectedValue.ToString());
break;
}
}



Please refer the sample in the below link which illustrates the above:

http://files.syncfusion.com/support/GGC.Web/7.3.0.20/89707_Grid/main.htm

Please try this and let me know if this helps you out.

Thanks,
Melba



Loader.
Live Chat Icon For mobile
Up arrow icon