I am having textbox inside my rad gridview and having one button.once if i give some value to that textbox and click the button.
how can i get the textbox value.Since i am having that textbox in data template i cant get it.
will anyone provide with sample code.
8 Answers, 1 is accepted
If you know which cell you are operating on, you can use the ChildrenOfType<T> method to find the TextBox that is inside it like this:
TextBox txt = cell.ChildrenOfType<TextBox>[0].
Please, send us a sample project if this does not help and explain the exact behavior that you would like to achieve. We will try to come up with something.
All the best,
Ross
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.
I have the same requirement, just difference is I have rad combo box insteed of text box. And on button click I have the selected item value of rad combobox in a variable. How can I do that? Can anyone tell me?
Thanks,
Kaustubh.
You can use exactly the same approach - just change the generic argument to desired type.
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.
I have tried, by changing the generic argument. But its not working.
Thanks,
Kaustubh.
Can you post your XAML (how the combo is declared) and the code that you have tried?
Kind regards,
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.
Hi,
Here I am giving the snippet what I have dont in xaml file for your understanding. If user selects sample2 item from combo box, then I have to retrieve that value and store it into sharepoint list.
<grid:RadGridView x:Name="grid" Margin="100,100,100,100" RowIndicatorVisibility="Collapsed" IsReadOnly="True" AutoGenerateColumns="False" CanUserFreezeColumns="False" CanUserResizeColumns="False" Width="520" Height="270" >
<grid:RadGridView.Columns>
<grid:GridViewDataColumn x:Name="gaugeColumn" Header="Header1" HeaderTextAlignment="Center" Width="150" DataMemberBinding="{Binding ID}" TextAlignment="Center"/>
<grid:GridViewDataColumn x:Name="measureColumn" HeaderText="Header2" HeaderTextAlignment="Center" Width="200">
<grid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<telerikInput:RadComboBox Name="cbMeasures" SelectedIndex="0">
<telerikInput:RadComboBoxItem Content="Sample1" />
<telerikInput:RadComboBoxItem Content="Sample2" />
<telerikInput:RadComboBoxItem Content="Sample3" />
<telerikInput:RadComboBoxItem Content="Sample4" />
</telerikInput:RadComboBox>
</DataTemplate>
</grid:GridViewDataColumn.CellTemplate>
</grid:GridViewDataColumn>
<grid:GridViewDataColumn HeaderText="Header3" HeaderTextAlignment="Center" Width="150">
<grid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<telerikInput:RadComboBox Name="cbDisplay" SelectedIndex="0" >
<telerikInput:RadComboBoxItem Content="Yes" />
<telerikInput:RadComboBoxItem Content="No" />
</telerikInput:RadComboBox>
</DataTemplate>
</grid:GridViewDataColumn.CellTemplate>
</grid:GridViewDataColumn>
</grid:RadGridView.Columns>
</grid:RadGridView>
Why not use SelectionChanged event of the combo directly?
Kind regards,
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.
private
void saveButton_Click(object sender, RoutedEventArgs e)
{
GridViewCell
secondCell = (GridViewCell)row.Items[1];
RadComboBox
txt = secondCell.ChildrenOfType<RadComboBox>[0];
}
At <RadComboBox>[0], it is giving error "RadCombobox is a 'type' but is used as 'variable' ".
also what this " 0 " indicating? Can you explain for me?
Thanks,
Kaustubh