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.
Unfortunately, activation email could not send to your email. Please try again.

combo box change event

Thread ID:

Created:

Updated:

Platform:

Replies:

42073 Mar 20,2006 01:12 AM Mar 20,2006 02:48 AM Windows Forms 6
loading
Tags: GridControl
Gayathri
Asked On March 20, 2006 01:12 AM

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.

Gayathri
Replied On March 20, 2006 01:18 AM

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.

Administrator [Syncfusion]
Replied On March 20, 2006 01:32 AM

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

Gayathri
Replied On March 20, 2006 02:10 AM

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

Gayathri
Replied On March 20, 2006 02:39 AM

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

Gayathri
Replied On March 20, 2006 02:48 AM

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

Gayathri
Replied On March 20, 2006 02:48 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;