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

[Solved] access column inside celltemplate

2 Answers 102 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.
Manish Agarwal
Top achievements
Rank 1
Manish Agarwal asked on 02 Nov 2009, 07:55 AM
Hi

I want to access column inside Celltemplate of my Grid View
Code :

<

 

telerikGridView:GridViewColumn Header="Is Answered" Width="*">

 

 

 

<telerikGridView:GridViewColumn.CellTemplate>

 

 

 

<DataTemplate>

 

 

 

<Grid>

 

 

 

<TextBlock x:Name="txtIsBlank" Text=" " TextAlignment="Center" ></TextBlock>

 

 

 

<TextBlock x:Name="txtIsAns" Text="..." TextAlignment="Center" ></TextBlock>

 

 

 

<Image Source="../Resources/icon_accepted.png" Image>

 

 

 

</Grid>

 

 

 

</DataTemplate>

 

 

 

</telerikGridView:GridViewColumn.CellTemplate>

 

 

 

</telerikGridView:GridViewColumn>

As from these Three values(Textblock,and Image) only one will be visible so i want to access this column in code behind and want to set the visibility depending on the condition.
This Column is inside the 2nd level of Hierarchical Grid.
I am using  WCFServices to get the data .

Please reply ASAP

Regards
Charu Pahuja

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 02 Nov 2009, 08:08 AM
Hello,

You can use Loaded event of your controls (TextBlock and Image) to set desired Visibility. Sender argument of the event handler is the control itself and DataContext property is your data item.

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Manish Agarwal
Top achievements
Rank 1
answered on 02 Nov 2009, 12:58 PM
Hi

Thanks a Lot.
It is working now


Regards
Charu
Tags
GridView
Asked by
Manish Agarwal
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Manish Agarwal
Top achievements
Rank 1
Share this question
or