Change the Seleted Item of a Combobox in a Child window from a Parent Window

3 posts, 1 answers
  1. Vuyiswa Maseko
    Vuyiswa Maseko avatar
    187 posts
    Member since:
    Jan 2010

    Posted 28 Mar 2011 Link to this post

    Good Evening

    I have a Datagrid and i selectedChange event of the Datagrid, i show a child wind and i bind the textbox controls of the child window from the Parent Window which has a datagrid. Now my problem is that there is a Combobox on the Child window, onbviously this combobox is binded after the child window has opened. The data is not Static , its coming from the DB. What i want is to set the selected item from the parent. This is what i am doing



         
    private void grdkids_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
          {
              //kid
                  KidsViewUpdateDetails KidsDetails = new KidsViewUpdateDetails();
     
     
                  KidsModelExtended model = (KidsModelExtended)this.grdkids.SelectedItem;
                   
                  KidsDetails.txtstudentnumber.Text = model.sStudentNumber;
               
                  KidsDetails.txtkidname.Text = model.sKidName;
                  KidsDetails.txtkidlastname.Text = model.sKidLastname;
                  KidsDetails.txtgrade.Text = model.sKidGrade;
                  KidsDetails.txtclass.Text = model.skidclass;
                  KidsDetails.ddlallergies.Text = model.sAllergyName;
                  KidsDetails.ddlschool.Text = model.sSchoolName;
                  GenericMethods.GenericMethods.SetCookie("kidId", model.iKidid.ToString());
                  KidsDetails.Show();
             
          }


    in this lines


     
    KidsDetails.ddlallergies.Text = model.sAllergyName;
      KidsDetails.ddlschool.Text = model.sSchoolName;


    i am trying set the selected item to be that. but when the Child load , there Combobox remain unselected

    This is the declaration of the Combobox

    <telerik:RadComboBox HorizontalAlignment="Left"  DisplayMemberPath="sAllergyName" SelectedValuePath="{Binding iAllergyID}" Margin="106,226,0,0" Name="ddlallergies" VerticalAlignment="Top" Width="142" Height="22">



    Thanks
  2. Answer
    George
    Admin
    George avatar
    1332 posts

    Posted 31 Mar 2011 Link to this post

    Hi Vuyiswa, 


    The SelectedValuePath property represents a string that specifies the path to the property that is used to determine the value of the SelectedValue property. Instead of using the SelectedValuePath, I would suggest you to bind the SelectedItem property. For more information about the RadComboBox selection, please refer to the following link: http://www.telerik.com/help/silverlight/radcombobox-features-selection.html

    I hope this helps.

    All the best,
    George
    the Telerik team
  3. DevCraft banner
  4. Vuyiswa Maseko
    Vuyiswa Maseko avatar
    187 posts
    Member since:
    Jan 2010

    Posted 31 Mar 2011 Link to this post


    thank you Gorge , i have resolved it a long time ago. i am sorry i did no update the post. Thank you for your help on the reporting part. all my issues are resolved.

    Thanks
Back to Top