Data View Problem

3 posts, 0 answers
  1. Md.Hasanuzzaman
    Md.Hasanuzzaman avatar
    31 posts
    Member since:
    Apr 2011

    Posted 11 May 2011 Link to this post

    I want to show data from a RadGridView to a TextBlock. I wrote C# and XAML code fine but i can`t understand why it dos`t show any data
    Here is Code:
    C# Code :

       private void button1_Click(object sender, RoutedEventArgs e)
            {
                DataTable myDataTable = new DataTable();
                DataColumn myDataColumn = new DataColumn();
                myDataColumn.ColumnName = "Name";
                myDataTable.Columns.Add(myDataColumn);
                myDataTable.Rows.Add("1");
                myDataTable.Rows.Add("2");
                myDataTable.Rows.Add("3");
                radGridView1.ItemsSource = myDataTable;
              
            }

    And XMAL CODE:

            <telerik:RadGridView HorizontalAlignment="Left" Margin="38,12,0,0" Name="radGridView1" VerticalAlignment="Top" AutoGenerateColumns="False" >
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="394,12,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
            <TextBlock Text="{Binding SelectedItem.Name, ElementName=radGridView1}" Margin="12,239,233,8" />


    Here i was wrong. Please Help Me. 
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 12 May 2011 Link to this post

    Hello,

     You can try {Binding [Name]} instead {Binding Name} for DataMemberBinding. Other possible solution is to use the DataTable DefaultView instead.

    Greetings,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Md.Hasanuzzaman
    Md.Hasanuzzaman avatar
    31 posts
    Member since:
    Apr 2011

    Posted 12 May 2011 Link to this post

    I use it but it  does`t work. if i use a exiting DataSet With a DataTable then it work fine.
Back to Top