none
passing datagrid values to combo box

    Question

  • hi friends
    iam using three text box and two combobox to submit the values in grid.
    on clicking the row in the grid the data will transfer to the respective controls, like name value transfer to the txtname and so on.
    iam using client side code:-
    var name = document.getElementById("rtxtname");
    name.innerText = args.get_gridDataItem().get_cell("name").innerText
    this is working for textbox controls.
    but my problem is, i problem is to pass grid values to the combo box. this coding is not working for combo box.
    any one can solve my problem.
    what changes to do for combo box.
    thanks in advance
    S.Rajkumar

    Thursday, February 09, 2012 12:43 AM

Answers

  • Hi Rajkumar,

    Do you maintain a custom class for your grid in xaml file. If so, then it is very easy.

    Based on your requirement, add an event for the row/ cell (value) that you need to get.

    inside the event ,

    Enumerable<YourDataObject> list = YourDataGrid.ItemsSource  as IEnumerable<YourDataObject>;

    YourDataObject item = list.SingleOrDefault(d=>d.ID == SomdID);

    if(item != null) // You find this item

       YourDataGrid.SelectedItem = item;  /

    then bind the value to the combobox . Hope it will help!

    Saturday, February 11, 2012 12:08 AM

All replies

  • iam using three text box and two combobox to submit the values in grid.

    i problem is to pass grid values to the combo box.

    Hi,

    Can you explain your issue more clearly? What do you mean by saying "pass grid values to the combo box"?

    If you mean do the binding when there are comboboxs in your DataGrid, you may refer:

    http://blog.digitaltools.com/post/2011/05/06/Binding-a-Datagride28099s-ComboBox.aspx

    Best Regards,

    Friday, February 10, 2012 4:26 AM
  • combo box is seperate from datagrid, not inside the grid.

    on click th erow in the grid, just i need to row values to pass to combo box.

    Friday, February 10, 2012 5:01 AM
  • Hi Rajkumar,

    Do you maintain a custom class for your grid in xaml file. If so, then it is very easy.

    Based on your requirement, add an event for the row/ cell (value) that you need to get.

    inside the event ,

    Enumerable<YourDataObject> list = YourDataGrid.ItemsSource  as IEnumerable<YourDataObject>;

    YourDataObject item = list.SingleOrDefault(d=>d.ID == SomdID);

    if(item != null) // You find this item

       YourDataGrid.SelectedItem = item;  /

    then bind the value to the combobox . Hope it will help!

    Saturday, February 11, 2012 12:08 AM