- Home
- Forum
- ASP.NET Web Forms (Classic)
- Related Dropdown with GridGroupingcontrol
Related Dropdown with GridGroupingcontrol
- Sep 18, 2008 11:46 AM UTC
- Sep 22, 2008 08:35 PM UTC
Hi
I am working with ASP.NET and using VS 2008.
I have used GridGroupingControl where I need to implement inline Edit/Update. I have done that with GridRowEditUpdateLink. Now I have related drop down in my Grid i.e. on selection of one dropdown value I want to filter another one based on some condition. I have used EditTemplate for dropdown to set at run time at GridGroupingControl1_QueryCellStyleInfo event. I have SelectedIndex event of first DDL, where I want to filter another one (This is one logic I am thinking of). But on Selectedindex Event my grid getting out of Edit mode. Can anybody please help me out how I can implement Related drop down in GridGroupingControl? Even I want to know on click of Edit how I can know Edit Index.
I have used Following code.
protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if ((e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell
|| e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
)
{
//&& (e.Style.CellType == "ComboBox")
if (e.TableCellIdentity.Column.Name == "Environment" )
{
////Record curRecord = this.GridGroupingControl1.FormEditCell.CurrentRecord;
////DropDownList tb = this.GridGroupingControl1.FormEditCell.FindControl("DropDownList1") as DropDownList;
//////Second Method.........
Entities.EnvironmentList objEnvList = new Entities.EnvironmentList();
Entities.Environment objEnv = new Entities.Environment("1", "Env1");
objEnvList.Add(objEnv);
objEnv = new Entities.Environment("2", "Env2");
objEnvList.Add(objEnv);
objEnv = new Entities.Environment("3", "Env3");
objEnvList.Add(objEnv);
objEnv = new Entities.Environment("4", "Env4");
objEnvList.Add(objEnv);
objEnv = new Entities.Environment("5", "Env5");
objEnvList.Add(objEnv);
DropDownList dropdown = new DropDownList();
dropdown.DataSource = objEnvList;
dropdown.DataTextField = "Description";
dropdown.DataValueField = "Name";
dropdown.AutoPostBack = true;
dropdown.SelectedIndexChanged += new EventHandler(DropDownList1_SelectedIndexChanged);
//Here we adding the DropDownListBox programatically using ITemplate Interface
TemplateClass mytemp = new TemplateClass(dropdown);
e.TableCellIdentity.Column.EditItemTemplate = mytemp;
}
if (e.TableCellIdentity.Column.Name == "Realese" )
{
Entities.RealeseList objRelList = new Entities.RealeseList();
Entities.Realese objRel = new Entities.Realese("1", "Rel1");
objRelList.Add(objRel);
objRel = new Entities.Realese("2", "Rel2");
objRelList.Add(objRel);
objRel = new Entities.Realese("3", "Rel3");
objRelList.Add(objRel);
objRel = new Entities.Realese("4", "Rel4");
objRelList.Add(objRel);
objRel = new Entities.Realese("5", "Rel5");
objRelList.Add(objRel);
DropDownList dropdown = new DropDownList();
dropdown.DataSource = objRelList;
dropdown.DataTextField = "Description";
dropdown.DataValueField = "Name";
dropdown.AutoPostBack = true;
dropdown.SelectedIndexChanged += new EventHandler(DropDownList2_SelectedIndexChanged);
//Here we adding the DropDownListBox programatically using ITemplate Interface
TemplateClass temp = new TemplateClass(dropdown);
e.TableCellIdentity.Column.EditItemTemplate = temp;
}
}
}
Any help will be appreciated.
I am working with ASP.NET and using VS 2008.
I have used GridGroupingControl where I need to implement inline Edit/Update. I have done that with GridRowEditUpdateLink. Now I have related drop down in my Grid i.e. on selection of one dropdown value I want to filter another one based on some condition. I have used EditTemplate for dropdown to set at run time at GridGroupingControl1_QueryCellStyleInfo event. I have SelectedIndex event of first DDL, where I want to filter another one (This is one logic I am thinking of). But on Selectedindex Event my grid getting out of Edit mode. Can anybody please help me out how I can implement Related drop down in GridGroupingControl? Even I want to know on click of Edit how I can know Edit Index.
I have used Following code.
protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if ((e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell
|| e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
)
{
//&& (e.Style.CellType == "ComboBox")
if (e.TableCellIdentity.Column.Name == "Environment" )
{
////Record curRecord = this.GridGroupingControl1.FormEditCell.CurrentRecord;
////DropDownList tb = this.GridGroupingControl1.FormEditCell.FindControl("DropDownList1") as DropDownList;
//////Second Method.........
Entities.EnvironmentList objEnvList = new Entities.EnvironmentList();
Entities.Environment objEnv = new Entities.Environment("1", "Env1");
objEnvList.Add(objEnv);
objEnv = new Entities.Environment("2", "Env2");
objEnvList.Add(objEnv);
objEnv = new Entities.Environment("3", "Env3");
objEnvList.Add(objEnv);
objEnv = new Entities.Environment("4", "Env4");
objEnvList.Add(objEnv);
objEnv = new Entities.Environment("5", "Env5");
objEnvList.Add(objEnv);
DropDownList dropdown = new DropDownList();
dropdown.DataSource = objEnvList;
dropdown.DataTextField = "Description";
dropdown.DataValueField = "Name";
dropdown.AutoPostBack = true;
dropdown.SelectedIndexChanged += new EventHandler(DropDownList1_SelectedIndexChanged);
//Here we adding the DropDownListBox programatically using ITemplate Interface
TemplateClass mytemp = new TemplateClass(dropdown);
e.TableCellIdentity.Column.EditItemTemplate = mytemp;
}
if (e.TableCellIdentity.Column.Name == "Realese" )
{
Entities.RealeseList objRelList = new Entities.RealeseList();
Entities.Realese objRel = new Entities.Realese("1", "Rel1");
objRelList.Add(objRel);
objRel = new Entities.Realese("2", "Rel2");
objRelList.Add(objRel);
objRel = new Entities.Realese("3", "Rel3");
objRelList.Add(objRel);
objRel = new Entities.Realese("4", "Rel4");
objRelList.Add(objRel);
objRel = new Entities.Realese("5", "Rel5");
objRelList.Add(objRel);
DropDownList dropdown = new DropDownList();
dropdown.DataSource = objRelList;
dropdown.DataTextField = "Description";
dropdown.DataValueField = "Name";
dropdown.AutoPostBack = true;
dropdown.SelectedIndexChanged += new EventHandler(DropDownList2_SelectedIndexChanged);
//Here we adding the DropDownListBox programatically using ITemplate Interface
TemplateClass temp = new TemplateClass(dropdown);
e.TableCellIdentity.Column.EditItemTemplate = temp;
}
}
}
Any help will be appreciated.
SIGN IN To post a reply.
1 Reply
RS
Rajarajeswari S
Syncfusion Team
September 22, 2008 08:35 PM UTC
Hi,
1. On selection of one dropdown value I want to filter another one based on some condition
Actually the ItemTemplate controls are created for the entire column and not for a particular cell. So we can't achieve your requirement directly, but there is a work around to solve this issue. Please refer the sample from the below link , with the work around:
http://websamples.syncfusion.com/samples/Grid.Web/6.3.0.10/Grid_Web_TemplateControls/main.htm
Here based on the selection of one dropdownlist another ones's property will be set.
Please have a look at the above and let us know if this helps you out.
Regards,
Raji
1. On selection of one dropdown value I want to filter another one based on some condition
Actually the ItemTemplate controls are created for the entire column and not for a particular cell. So we can't achieve your requirement directly, but there is a work around to solve this issue. Please refer the sample from the below link , with the work around:
http://websamples.syncfusion.com/samples/Grid.Web/6.3.0.10/Grid_Web_TemplateControls/main.htm
Here based on the selection of one dropdownlist another ones's property will be set.
Please have a look at the above and let us know if this helps you out.
Regards,
Raji
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
AD Administrator
- Sep 18, 2008 11:46 AM UTC
- Sep 22, 2008 08:35 PM UTC