Hi Viewers'
i'm working on infragistics webcombo control.
i'm stucked with this control on SelectedIndex change on cascading webcombo.
i've to webcombo control 1 category and 2 is sub categories.
when i'm changing category that time it's not changing the sub categories webcombo control.
protected void wc_SelectedRowChanged(object sender, Infragistics.WebUI.WebCombo.SelectedRowChangedEventArgs e)
{
wc_Course.DataBind();
wc_Course.Rows.Clear();
DataSet Ds= gettingrowsmethod()
DataRow dr;
dt.Columns.Add(new DataColumn("SubCategoryName", typeof(string)));
dr= dt.NewRow();
dr[0] = Ds.Tables[0].Rows[i][0].ToString();
dr[1] = Ds.Tables[0].Rows[i][1].ToString();
dt.Rows.Add(dr);
}
dr= dtType.NewRow();
dt.Rows.InsertAt(dr, 0);
wc_Course.DataTextField = "Course_TypeName";
wc_Course.DataSource = dt.DefaultView;
wc_Course.SelectedIndex = wc_CourseType.FindByValue("Select course type").Row.Index;
please let me no what wrong i've done in the above coding...
thanks in advance
ateeqpasha
Hello,
I am trying to reproduce the problem in something similar to your scenario,unfortunately to no avail. Please check out my code below - in all cases, the selected index matched the selected index of the first combo. The only thing that I am guessing is that the combobox is somehow rebound again later in the lifecycle (e.g. do you have DataSourceID set for the second combo? Do you rebind it again somehow, in Page_Load or PrePrender).
Here is the working code (2008.3 version)
<igcmbo:WebCombo ID="WebCombo1" runat="server" BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" ForeColor="Black" onselectedrowchanged="WebCombo1_SelectedRowChanged" SelBackColor="DarkBlue" SelForeColor="White" Version="4.00"> <Columns> <igtbl:UltraGridColumn> <header caption="Column0"> </header> </igtbl:UltraGridColumn> </Columns> <expandeffects shadowcolor="LightGray" /> <dropdownlayout bordercollapse="Separate" rowheightdefault="20px" version="4.00"> <framestyle backcolor="Silver" borderstyle="Ridge" borderwidth="2px" cursor="Default" font-names="Verdana" font-size="10pt" height="130px" width="325px"> </framestyle> <HeaderStyle BackColor="LightGray" BorderStyle="Solid"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </HeaderStyle> <RowStyle BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px"> <borderdetails widthleft="0px" widthtop="0px" /> </RowStyle> <SelectedRowStyle BackColor="DarkBlue" ForeColor="White" /> </dropdownlayout> </igcmbo:WebCombo> <igcmbo:WebCombo ID="WebCombo2" runat="server" BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" ForeColor="Black" SelBackColor="DarkBlue" SelForeColor="White" Version="4.00"> <Columns> <igtbl:UltraGridColumn> <header caption="Column0"> </header> </igtbl:UltraGridColumn> </Columns> <expandeffects shadowcolor="LightGray" /> <dropdownlayout bordercollapse="Separate" rowheightdefault="20px" version="4.00"> <framestyle backcolor="Silver" borderstyle="Ridge" borderwidth="2px" cursor="Default" font-names="Verdana" font-size="10pt" height="130px" width="325px"> </framestyle> <HeaderStyle BackColor="LightGray" BorderStyle="Solid"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </HeaderStyle> <RowStyle BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px"> <borderdetails widthleft="0px" widthtop="0px" /> </RowStyle> <SelectedRowStyle BackColor="DarkBlue" ForeColor="White" /> </dropdownlayout> </igcmbo:WebCombo> private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Column1", typeof(string))); dt.Columns.Add(new DataColumn("Column2", typeof(string))); dt.Rows.Add(new string [ { "One", "Two" }); dt.Rows.Add(new string [ { "Two", "Three" }); dt.Rows.Add(new string [ { "Four", "Five" }); return dt; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { WebCombo1.DataSource = GetData(); WebCombo1.DataBind(); } } protected void WebCombo1_SelectedRowChanged(object sender, Infragistics.WebUI.WebCombo.SelectedRowChangedEventArgs e) { WebCombo2.DataSource = GetData(); WebCombo2.DataBind(); WebCombo2.SelectedIndex = e.Row.Index; }