locked
Reading text from textboxes that are in a dataform RRS feed

  • Question

  •  Please help me i am trying to read the text that is situated into a textbox. The textbox is allocated inside a dataform! Below you will find the code . Lets have "txt_IndepOrgId" as an example... how can i read from that textbox ?

     

     

      <dataFormToolkit:DataForm AutoGenerateFields="False" Name="NeedForm" Width="215" Height="400" AutoEdit="False" CommandButtonsVisibility="Edit" HorizontalAlignment="Left">
                                        <dataFormToolkit:DataForm.EditTemplate>
                                            <DataTemplate>
                                                <StackPanel>
                                                    <dataFormToolkit:DataField>
                                                        <TextBox x:Name="txt_IndepOrgId" Text="{Binding IndepOrgId}"></TextBox>
                                                    </dataFormToolkit:DataField>
                                                    <dataFormToolkit:DataField>
                                                        <TextBox Name="txt_NeedId" Text="{Binding Id}"></TextBox>
                                                    </dataFormToolkit:DataField>
                                                    <dataFormToolkit:DataField>
                                                        <TextBox Name="txt_Name" Text="{Binding Name}"></TextBox>
                                                    </dataFormToolkit:DataField>
                                                    <dataFormToolkit:DataField>
                                                        <TextBox Name="txt_Description" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" Width="95" Height="70" Text="{Binding Description}"></TextBox>
                                                    </dataFormToolkit:DataField>
                                                    <dataFormToolkit:DataField>
                                                        <TextBox Text="{Binding TargetMoney}"></TextBox>
                                                    </dataFormToolkit:DataField>
                                                    <dataFormToolkit:DataField>
                                                        <Slider Value="{Binding Priority, Mode=TwoWay}" LargeChange="1" x:Name="Slider" Width="103" Height="20" Maximum="10" Minimum="1"></Slider>
                                                    </dataFormToolkit:DataField>
                                                    <dataFormToolkit:DataField>
                                                        <TextBox Text="{Binding AccountNumber}"></TextBox>
                                                    </dataFormToolkit:DataField>
                                                    <dataFormToolkit:DataField>
                                                        <TextBox Text="{Binding Longitude}"></TextBox>
                                                    </dataFormToolkit:DataField>
                                                    <dataFormToolkit:DataField>
                                                        <TextBox Text="{Binding Latitude}"></TextBox>
                                                    </dataFormToolkit:DataField>
                                                    <dataFormToolkit:DataField>
                                                        <Button Name="Location" MouseEnter="Button_MouseEnter">
                                                            <TextBlock Text="Set Location"></TextBlock>
                                                        </Button>
                                                    </dataFormToolkit:DataField>
                                                </StackPanel>
                                            </DataTemplate>
                                        </dataFormToolkit:DataForm.EditTemplate>
                                    </dataFormToolkit:DataForm>
      
    Thursday, April 22, 2010 2:22 PM

Answers

  •  Sure you can do something like

     

    TextBox txtBox = dataForm.FindNameInContent("txt_IndepOrgId") as TextBox;

    then get txtBox.Text

     

     

     

    Thursday, April 22, 2010 2:36 PM

All replies

  •  Sure you can do something like

     

    TextBox txtBox = dataForm.FindNameInContent("txt_IndepOrgId") as TextBox;

    then get txtBox.Text

     

     

     

    Thursday, April 22, 2010 2:36 PM
  •  Thanks very much you made my day :D

    Thursday, April 22, 2010 2:42 PM
  •  Your very welcome!

    Thursday, April 22, 2010 3:32 PM