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

Tick on checkbox and enable textbox in Silverlight

2 Answers 176 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
lucerias
Top achievements
Rank 1
lucerias asked on 07 Nov 2011, 03:50 PM
What is the equivalent code in ASP and Silver 4 of the following code shown as below.
 
What i am trying to achieve is something like this. I have four columns in RadGridView, first col is CustomerID, second is CustomerName, third is CustomerAddress followed by the last col, which contains checkbox.

When user ticks on a checkbox, the customer address textbox of a particular row will be enabled.
When user unticks on a checkbox, the customer address textbox of a particular row will be disabled.

May i know how to do this, thanks in advanced.


protected void Edit(object sender, EventArgs e) 
{
    RadTextBox textbox; 
    ChkBox checkbox = (ChkBox)sender; 
    GridItem item = (GridItem)box.NamingContainer ; 
    textbox= (RadTextBox)item.FindControl("txtEditCustAdd"); 
   
    if (checkbox.Checked) 
    {
        textbox.Enabled = true; 
    }
    else 
    {
        textbox.Enabled = false; 
        textbox.Text = ""; 
    }
  
}

2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 07 Nov 2011, 05:34 PM
Hi Lucerias,

Is the checkBox in the same row as the text box or is it outside the RadGridView ?


Kind regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
lucerias
Top achievements
Rank 1
answered on 08 Nov 2011, 01:36 AM
Hi,

As i mentioned in the thread

"What i am trying to achieve is something like this. I have four columns in RadGridView, first col is CustomerID, second is CustomerName, third is CustomerAddress followed by the last col, which contains checkbox."

Hence, it is in the same row as the text box.
Please let me know if you have any idea.

xaml is shown as below.

<Grid x:Name="LayoutRoot" SizeChanged="LayoutRoot_SizeChanged">
    <Border Background="Transparent" BorderBrush="Black" BorderThickness="1" Padding="20" Width="Auto" 
            Height="Auto">
        <Grid ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
            <Grid.RowDefinitions>
                <RowDefinition Height="10" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid Grid.Row="1">
                <StackPanel >
                    <telerik:RadGridView x:Name="gridCustomer"
                            EnableRowVirtualization="True" AutoGenerateColumns="False" CanUserFreezeColumns="False" ShowGroupPanel="False" MinHeight="295" MaxHeight="295"
                            CanUserResizeColumns="False" CanUserInsertRows="True" ItemsSource="{Binding}" AddingNewDataItem="gridCustomer_AddNew">
                          
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn Header="Customer Name" DataMemberBinding="{Binding CustName, Mode=TwoWay}" />
                            <telerik:GridViewDataColumn Header="Customer Description" DataMemberBinding="{Binding CustDesc, Mode=TwoWay}" />
              
                            <telerik:GridViewDataColumn Header="Edit">
                                <telerik:GridViewDataColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox IsChecked="{Binding NewAdded, Mode=TwoWay}" Checked="Edit"/>
                                    </DataTemplate>
                                </telerik:GridViewDataColumn.CellTemplate>
                                <telerik:GridViewDataColumn.CellEditTemplate>
                                    <DataTemplate>
                                        <CheckBox IsChecked="{Binding NewAdded, Mode=TwoWay}" Checked="Edit" />
                                    </DataTemplate>
                                </telerik:GridViewDataColumn.CellEditTemplate>
                                  
                            </telerik:GridViewDataColumn>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                    <myclr:ucCustPager x:Name="ucCustomerPager" />
                </StackPanel>
            </Grid>



Thanks.
Tags
General Discussions
Asked by
lucerias
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
lucerias
Top achievements
Rank 1
Share this question
or