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

combo box change event

Hi, I have two cells of type combobox, say combo1 and combo2 in the grid. combo2 is dependant on combo1, that is, based on combo1''s value, the values in combo2 are populated. So, I need to capture the change event of combo1. Can anyone please help me on this? Thanks, Gayathri.

6 Replies

GA Gayathri March 20, 2006 06:18 AM UTC

I tried using cellschanged event, but I am not able to capture the row and column value using that event, I need atleast the row that has changed to populate the corresponding combo2 column.. >Hi, > >I have two cells of type combobox, say combo1 and combo2 in the grid. combo2 is dependant on combo1, that is, based on combo1''s value, the values in combo2 are populated. So, I need to capture the change event of combo1. Can anyone please help me on this? > >Thanks, >Gayathri.


AD Administrator Syncfusion Team March 20, 2006 06:32 AM UTC

Hi Gayathri, You can use the CurrentCellShowingDropDown event for this issue. Here is the code snippet, explains a simple way to change the dropdown contents depend on the previous column value. GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; if(cc.ColIndex == 3) { GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; cr.ListBoxPart.Items.Clear(); switch(this.gridDataBoundGrid1[cc.RowIndex,cc.ColIndex - 1].Text) { case "One": cr.ListBoxPart.Items.Add("1"); break; case "Two": cr.ListBoxPart.DataSource = null; break; case "Three": { for(int i= 0; i < items3.Count; i++) cr.ListBoxPart.Items.Add(items3[i]); break; } case "Four": cr.ListBoxPart.DataSource = theArrayList; break; case "Five": cr.ListBoxPart.Items.Add("2"); break; } Here is a sample project. Let us know if this helps. Best regards, Madhan


GA Gayathri March 20, 2006 07:10 AM UTC

Hi, I tried using the CurrentCellShowingDropDown event.. but the breakpoint is not getting fired while i am focussing on the combo.. actually, the breakpoint is not getting fired at all events..Am i on the right track? I tried opening up the project you had given, but it does not have the relevant reference..I am using Syncfusion Essential suite version 1.5. Thanks, Gayathri >Hi Gayathri, > >You can use the CurrentCellShowingDropDown event for this issue. Here is the code snippet, explains a simple way to change the dropdown contents depend on the previous column value. > >GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; >if(cc.ColIndex == 3) >{ >GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; >cr.ListBoxPart.Items.Clear(); >switch(this.gridDataBoundGrid1[cc.RowIndex,cc.ColIndex - 1].Text) >{ >case "One": >cr.ListBoxPart.Items.Add("1"); >break; >case "Two": >cr.ListBoxPart.DataSource = null; >break; >case "Three": >{ >for(int i= 0; i < items3.Count; i++) >cr.ListBoxPart.Items.Add(items3[i]); >break; >} >case "Four": >cr.ListBoxPart.DataSource = theArrayList; >break; >case "Five": >cr.ListBoxPart.Items.Add("2"); >break; >} > >Here is a sample project. >Let us know if this helps. > >Best regards, >Madhan


GA Gayathri March 20, 2006 07:39 AM UTC

Hi, yeah.. I just rebuilt my application and it started working, Thanks a ton.. I also have another doubt.. I am getting values from the database for populating both the combos.. I am using displaymember and valuemember properties.. That is working fine.. say, for combo1 , value is 1, and the text is "One".. value is 2, the text is "Two".. For populating combo2, I can use the text property of combo1 (that is 1,2,3..etc).. but I need the text''s value also.. How do i get it? At present, when i give grid1(row1,col1).text , it is giving 1..instead of "one"..how do I get "one"? Thanks, Gayathri. >Hi, > >I tried using the CurrentCellShowingDropDown event.. but the breakpoint is not getting fired while i am focussing on the combo.. actually, the breakpoint is not getting fired at all events..Am i on the right track? I tried opening up the project you had given, but it does not have the relevant reference..I am using Syncfusion Essential suite version 1.5. > >Thanks, >Gayathri > >>Hi Gayathri, >> >>You can use the CurrentCellShowingDropDown event for this issue. Here is the code snippet, explains a simple way to change the dropdown contents depend on the previous column value. >> >>GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; >>if(cc.ColIndex == 3) >>{ >>GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; >>cr.ListBoxPart.Items.Clear(); >>switch(this.gridDataBoundGrid1[cc.RowIndex,cc.ColIndex - 1].Text) >>{ >>case "One": >>cr.ListBoxPart.Items.Add("1"); >>break; >>case "Two": >>cr.ListBoxPart.DataSource = null; >>break; >>case "Three": >>{ >>for(int i= 0; i < items3.Count; i++) >>cr.ListBoxPart.Items.Add(items3[i]); >>break; >>} >>case "Four": >>cr.ListBoxPart.DataSource = theArrayList; >>break; >>case "Five": >>cr.ListBoxPart.Items.Add("2"); >>break; >>} >> >>Here is a sample project. >>Let us know if this helps. >> >>Best regards, >>Madhan


GA Gayathri March 20, 2006 07:48 AM UTC

yeah.. I used the formattedtext property and got the text. Again, thanks a lot for the immediate response. >Hi, > >yeah.. I just rebuilt my application and it started working, Thanks a ton.. > >I also have another doubt.. I am getting values from the database for populating both the combos.. I am using displaymember and valuemember properties.. That is working fine.. say, for combo1 , value is 1, and the text is "One".. value is 2, the text is "Two".. For populating combo2, I can use the text property of combo1 (that is 1,2,3..etc).. but I need the text''s value also.. How do i get it? At present, when i give grid1(row1,col1).text , it is giving 1..instead of "one"..how do I get "one"? > >Thanks, >Gayathri. > >>Hi, >> >>I tried using the CurrentCellShowingDropDown event.. but the breakpoint is not getting fired while i am focussing on the combo.. actually, the breakpoint is not getting fired at all events..Am i on the right track? I tried opening up the project you had given, but it does not have the relevant reference..I am using Syncfusion Essential suite version 1.5. >> >>Thanks, >>Gayathri >> >>>Hi Gayathri, >>> >>>You can use the CurrentCellShowingDropDown event for this issue. Here is the code snippet, explains a simple way to change the dropdown contents depend on the previous column value. >>> >>>GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; >>>if(cc.ColIndex == 3) >>>{ >>>GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; >>>cr.ListBoxPart.Items.Clear(); >>>switch(this.gridDataBoundGrid1[cc.RowIndex,cc.ColIndex - 1].Text) >>>{ >>>case "One": >>>cr.ListBoxPart.Items.Add("1"); >>>break; >>>case "Two": >>>cr.ListBoxPart.DataSource = null; >>>break; >>>case "Three": >>>{ >>>for(int i= 0; i < items3.Count; i++) >>>cr.ListBoxPart.Items.Add(items3[i]); >>>break; >>>} >>>case "Four": >>>cr.ListBoxPart.DataSource = theArrayList; >>>break; >>>case "Five": >>>cr.ListBoxPart.Items.Add("2"); >>>break; >>>} >>> >>>Here is a sample project. >>>Let us know if this helps. >>> >>>Best regards, >>>Madhan


GA Gayathri March 20, 2006 07:48 AM UTC

yeah.. I used the formattedtext property and got the text. Again, thanks a lot for the immediate response. >Hi, > >yeah.. I just rebuilt my application and it started working, Thanks a ton.. > >I also have another doubt.. I am getting values from the database for populating both the combos.. I am using displaymember and valuemember properties.. That is working fine.. say, for combo1 , value is 1, and the text is "One".. value is 2, the text is "Two".. For populating combo2, I can use the text property of combo1 (that is 1,2,3..etc).. but I need the text''s value also.. How do i get it? At present, when i give grid1(row1,col1).text , it is giving 1..instead of "one"..how do I get "one"? > >Thanks, >Gayathri. > >>Hi, >> >>I tried using the CurrentCellShowingDropDown event.. but the breakpoint is not getting fired while i am focussing on the combo.. actually, the breakpoint is not getting fired at all events..Am i on the right track? I tried opening up the project you had given, but it does not have the relevant reference..I am using Syncfusion Essential suite version 1.5. >> >>Thanks, >>Gayathri >> >>>Hi Gayathri, >>> >>>You can use the CurrentCellShowingDropDown event for this issue. Here is the code snippet, explains a simple way to change the dropdown contents depend on the previous column value. >>> >>>GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; >>>if(cc.ColIndex == 3) >>>{ >>>GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; >>>cr.ListBoxPart.Items.Clear(); >>>switch(this.gridDataBoundGrid1[cc.RowIndex,cc.ColIndex - 1].Text) >>>{ >>>case "One": >>>cr.ListBoxPart.Items.Add("1"); >>>break; >>>case "Two": >>>cr.ListBoxPart.DataSource = null; >>>break; >>>case "Three": >>>{ >>>for(int i= 0; i < items3.Count; i++) >>>cr.ListBoxPart.Items.Add(items3[i]); >>>break; >>>} >>>case "Four": >>>cr.ListBoxPart.DataSource = theArrayList; >>>break; >>>case "Five": >>>cr.ListBoxPart.Items.Add("2"); >>>break; >>>} >>> >>>Here is a sample project. >>>Let us know if this helps. >>> >>>Best regards, >>>Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon