This is a migrated thread and some comments may be shown as answers.

RowDetailsTemplate

2 Answers 117 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris Phelps
Top achievements
Rank 1
Chris Phelps asked on 31 Dec 2010, 10:21 PM
Hello,

I'm sure this is probably answered somewhere in the thousands of posts in this forum, but after quite and extensive search I'm coming up empty.

Using the RadGridView with a RowDetailsTemplate, I'm trying to access the properties of the controls within the template.

For example -from your example, if I were to make the City TextBlock a TextBox, how could I change the text in that textbox?

<telerikGrid:RadGridView x:Name="radGridView"
                       
LoadingRowDetails="radGridView_LoadingRowDetails">
  
<telerikGrid:RadGridView.RowDetailsTemplate>
      
<DataTemplate>
          
<StackPanel Orientation="Horizontal">
              
<TextBlock Text="City: " />
              
<TextBlock Text="{Binding City}" />
          
</StackPanel>
      
</DataTemplate>
  
</telerikGrid:RadGridView.RowDetailsTemplate>
   
...
</telerikGrid:RadGridView>

I need to do various things with various controls, but cant figure out how to get access to their properties.  In this simple example, I'm trying to hide a TextBlock if it's clicked on, but the "Handles txtContactName.MouseLeftButtonUp" part of the Private Sub gives the error "Handles Clause requires a WithEvents variable defined in the containing type or one of it's base types"

 

 


Private
Sub txtContactName_MouseLeftButtonUp(ByVal sender As System.Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles txtContactName.MouseLeftButtonUp

 

 

 

Dim mytxtBox As TextBlock = TryCast(Me.ContactsRadGridView.FindName("txtContactName"), TextBlock)

 

mytxtBox.Visibility = Windows.

 

Visibility.Collapsed

 

 

 

End Sub

 


Any thoughts?

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 03 Jan 2011, 08:02 AM
Hello,

 The recommended approach in such cases is MVVM - you need to bind Text for this TextBoxes to your view model properties. 

Greetings,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Nandita
Top achievements
Rank 1
answered on 25 Apr 2011, 10:58 AM
Hi,

Sorry for joining in late. But in continuity i want to say that i have bind this control already with a property.

The need why i want this TextBlock or any contorl for that matter is while i am printing. the records.

Well what i want is to create dynamic column from the controls is the detail template which have Tag property attached to it having header name as its value.

So, by using the latest print functionality via the RichTextBox i want to add cells in header and the details rows.

But i am not able to find these controls until the detail section is expanded, which i don't want.

Is there any simpler way to achieve this apart from LoadingRowDetails template as i have a single static method to print each of the list in the application which i don't want to change now.
Tags
GridView
Asked by
Chris Phelps
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Nandita
Top achievements
Rank 1
Share this question
or