Getting Textbox value

9 posts, 1 answers
  1. Karthi Keyan
    Karthi Keyan avatar
    17 posts
    Member since:
    Oct 2009

    Posted 15 Oct 2009 Link to this post

    Hi,
            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.
  2. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 15 Oct 2009 Link to this post

    Hi Karthi Keyan,

    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.
  3. DevCraft banner
  4. Kaustubh Wadi
    Kaustubh Wadi avatar
    26 posts
    Member since:
    Apr 2010

    Posted 12 Apr 2010 Link to this post

    Hi all,
    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.
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 12 Apr 2010 Link to this post

    Hello,

    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.
  6. Kaustubh Wadi
    Kaustubh Wadi avatar
    26 posts
    Member since:
    Apr 2010

    Posted 12 Apr 2010 Link to this post

    Thanks Vlad for your response.
        I have tried, by changing the generic argument. But its not working.

    Thanks,
    Kaustubh.
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 12 Apr 2010 Link to this post

    Hello,

    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.
  8. Kaustubh Wadi
    Kaustubh Wadi avatar
    26 posts
    Member since:
    Apr 2010

    Posted 12 Apr 2010 Link to this post

    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>

     

  9. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 12 Apr 2010 Link to this post

    Hello,

    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.
  10. Kaustubh Wadi
    Kaustubh Wadi avatar
    26 posts
    Member since:
    Apr 2010

    Posted 12 Apr 2010 Link to this post

    In codebehind file:


    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

     

Back to Top
DevCraft banner