views:

210

answers:

1

Whenever a user adds a new record to the dataform I want to auto populate a field(integer datatype) with a default value, but I am not sure how to do this. I should also mention that I am populating the dataform using RIA services. Any ideas?

+1  A: 

I found a way to do it. What you have to do is give the field a name in XAML:

<dataFormToolkit:DataField >
     <TextBox x:Name="dftb_examid" Text="{Binding ExamId, Mode=TwoWay}" />
</dataFormToolkit:DataField>

Then in the clicked event on the update button:

private void cb_update_Click(object sender, RoutedEventArgs e)
{
    TextBox tb = df_eq.FindNameInContent("dftb_examid") as TextBox;
     tb.Text = "12345";
}
Weston Goodwin