This question is locked. New answers and comments are not allowed.
Hi,
I want to access the gridview columns from code-behind so i can set their values dynamically. In my code, I have to set the source of image(imgLogo, imgFlag) and text of a textblock(txtLocation). When selected at RadTabControl, the Gridview from DataTemplate will load, but they are in UserControl.Resources and im not sure how to access them.
Thanks,
Cielo
I want to access the gridview columns from code-behind so i can set their values dynamically. In my code, I have to set the source of image(imgLogo, imgFlag) and text of a textblock(txtLocation). When selected at RadTabControl, the Gridview from DataTemplate will load, but they are in UserControl.Resources and im not sure how to access them.
<UserControl.Resources> <MyDs:CompanyTypeContext x:Key="Code"/> <riaControls:DomainDataSource x:Name="CompanyTypeDDS"> <riaControls:DomainDataSource.DomainContext> <MyDs:CompanyTypeContext/> </riaControls:DomainDataSource.DomainContext> </riaControls:DomainDataSource> <riaControls:DomainDataSource x:Name="CountryListDDS"> <riaControls:DomainDataSource.DomainContext> <MyDs:CountryListContext/> </riaControls:DomainDataSource.DomainContext> </riaControls:DomainDataSource> <riaControls:DomainDataSource x:Name="ClientListDDS"> <riaControls:DomainDataSource.DomainContext> <MyDs:ClientListContext/> </riaControls:DomainDataSource.DomainContext> </riaControls:DomainDataSource> <DataTemplate x:Key="TabItemTemplate" x:Name="ClientContent"> <Button Command="{Binding ElementName=CompanyTypeDDS, Path=DataContext.StepChangeCommand}" CommandParameter="{Binding}"> <Button.Content> <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left" Width="700"> <Grid> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <TextBlock Text="{Binding Name}" Grid.Row="0" x:Name="IndustryCode"/> <telerik:RadGridView Grid.Row="1" ItemsSource="{Binding ElementName=ClientListDDS, Path=Data}"> <telerik:RadGridView.Columns> <telerik:GridViewImageColumn ImageHeight="62" ImageWidth="90" x:Name="imgLogo" /> <telerik:GridViewImageColumn ImageHeight="11" ImageWidth="16" x:Name="imgFlag"/> <telerik:GridViewDataColumn> <telerik:GridViewDataColumn.CellTemplate> <DataTemplate> <Grid> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <TextBlock Margin="2" Grid.Row="0" Text="{Binding NameOnReferenceList}" FontWeight="Bold" /> <TextBlock Margin="2" Grid.Row="1" x:Name="txtLocation" /> </Grid> </DataTemplate> </telerik:GridViewDataColumn.CellTemplate> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn DataMemberBinding="{Binding RefDescription}" /> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid> </StackPanel> </Button.Content> </Button> </DataTemplate> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White" Width="800"> <Grid.RowDefinitions> <RowDefinition Height="33*" /> <RowDefinition Height="267*" /> </Grid.RowDefinitions> <telerik:RadComboBox Grid.Row="0" SelectedValuePath="Code" ItemsSource="{Binding ElementName=CountryListDDS, Path=Data}" DisplayMemberPath="Country" x:Name="ddlCountry" VerticalAlignment="Top" VerticalContentAlignment="Top" HorizontalAlignment="Left" HorizontalContentAlignment="Left" /> <telerik:RadTabControl Grid.Row="1" Name="RadTabIndustry" VerticalAlignment="Top" TabOrientation="Vertical" TabStripPlacement="Left" OverflowMode="Wrap" VerticalContentAlignment="Top" ItemsSource="{Binding ElementName=CompanyTypeDDS, Path=Data}" DisplayMemberPath="Name" Align="Right" ContentTemplate="{StaticResource TabItemTemplate}" HorizontalAlignment="Left" HorizontalContentAlignment="Left" IsTextSearchEnabled="False"> </telerik:RadTabControl> </Grid>Private Sub GetReferenceList(ByVal sEGSId As String, ByVal lngCodeCountryLocal As Long, _ ByVal lngCodeCountry As Long, ByVal flagLocal As Boolean, _ ByVal lngLang As Long, Optional ByVal intProductGroup As Integer = -1, _ Optional ByVal intCompanyType As Integer = -1) Dim oDDSClientList As DomainDataSource = Me.Resources("ClientListDDS") Dim parSessionID As New Parameter Dim parCodeCountryLocal As New Parameter Dim parCodeCountry As New Parameter Dim parForLocal As New Parameter Dim parLang As New Parameter Dim parProductGroup As New Parameter Dim parCompanyType As New Parameter parSessionID.ParameterName = "sessionId" parCodeCountryLocal.ParameterName = "codeCountryLocal" parCodeCountry.ParameterName = "codeCountry" parForLocal.ParameterName = "forLocal" parLang.ParameterName = "lang" parProductGroup.ParameterName = "productGroup" parCompanyType.ParameterName = "companyType" parSessionID.Value = sEGSId parCodeCountryLocal.Value = lngCodeCountryLocal parCodeCountry.Value = lngCodeCountry parForLocal.Value = flagLocal parLang.Value = lngLang parProductGroup.Value = intProductGroup parCompanyType.Value = intCompanyType oDDSClientList.QueryParameters.Clear() oDDSClientList.QueryName = "GetClientList" oDDSClientList.QueryParameters.Add(parSessionID) oDDSClientList.QueryParameters.Add(parCodeCountryLocal) oDDSClientList.QueryParameters.Add(parCodeCountry) oDDSClientList.QueryParameters.Add(parForLocal) oDDSClientList.QueryParameters.Add(parLang) oDDSClientList.QueryParameters.Add(parProductGroup) oDDSClientList.QueryParameters.Add(parCompanyType) oDDSClientList.Load() End SubPrivate Sub RadTabIndustry_SelectionChanged(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles RadTabIndustry.SelectionChanged _intCodeCountryLocal = ddlCountry.SelectedValue _intCodeCountry = ddlCountry.SelectedValue subShowReferenceDetails1() End SubThanks,
Cielo