locked
DataForm Feilds Order RRS feed

  • Question

  • Hi I am having couple of issue with DataForm,

    I have a DataGrid in SilverLight4, i want to give edit row functionality with DataForm.

    When i double click on the datagrid, datagrid beginedit event fires, there i set the dataform.currentitem =

    e.Row.DataContext , Autogeneratefieds = True but my problem is

    1) Fields are not ordered properly, if i want to re-arrange the fields as per my requirement what must i do?

    2) I have a combobox in datagrid when i display the data in dataform, how can i bound the combobox inside a dataform?

    3) Cancel button is disabled always, if i want to cancel the changes i can't. how can i enable the Cancel button?

     

    Any help would be greatly appreciated.

     

    Regards

    Sri

    Saturday, October 29, 2011 7:10 AM

Answers

  • 1) Fields are not ordered properly, if i want to re-arrange the fields as per my requirement what must i do?

    Greg Bachraty have given a ferfect answer.

    2) I have a combobox in datagrid when i display the data in dataform, how can i bound the combobox inside a dataform?

    Just set the SelectedValue of the combobox.It will selected automaticlly.

    3) Cancel button is disabled always, if i want to cancel the changes i can't. how can i enable the Cancel button?

    The cancel button will only be enabled if the AutoCommit="False"

     

    Monday, October 31, 2011 2:38 AM

All replies

  • Hi, have you DataTemplate? Is the way to setup your own layout and bindings - should solve 1) and 2). As to 3) I suppose AutoEdit is not set, therefore DataForm is not in Edit Mode.

    Cheers, Greg

    Sunday, October 30, 2011 7:59 AM
  • Field order is determined by the DisplayAttribute Order property on your class properties. E.g.

    [Display(Name="My Second Property", Order=1)]
    public object Property2 { get; set; }
    [Display(Name="My First Property", Order=0)]
    public object Property1 { get; set; }

    If you need something special then you should turn auto generating fields off and set the DataForm templates manually, that way you can customize what contorl is generated for each field.

    Sunday, October 30, 2011 8:28 AM
  • 1) Fields are not ordered properly, if i want to re-arrange the fields as per my requirement what must i do?

    Greg Bachraty have given a ferfect answer.

    2) I have a combobox in datagrid when i display the data in dataform, how can i bound the combobox inside a dataform?

    Just set the SelectedValue of the combobox.It will selected automaticlly.

    3) Cancel button is disabled always, if i want to cancel the changes i can't. how can i enable the Cancel button?

    The cancel button will only be enabled if the AutoCommit="False"

     

    Monday, October 31, 2011 2:38 AM