Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WPF
1) I have two groups of radio buttons each containing two radio button i want to check which is selected and give it value to database
2) Also I want To restrict user to enter value in between 2 values in a text box
i.e min and max value for text box
 

XAML Code is As
 
 
<UserControl xmlns:PrpGridCtrl="clr-namespace:PrpGridCtrl;assembly=PrpGridCtrl"  
             x:Class="PROPIPE_MAIN.Forms.frm_Oil_Fired_Boilers"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="650" Name="oilfrbio" Loaded="oilfrbio_Loaded">
            <Border BorderThickness="4" CornerRadius="4" Margin="0.5" BorderBrush="CadetBlue" removed="LightGray">
        <Grid>
            <Grid.Resources>
                <ControlTemplate x:Key="TextBoxErrorTemplate">
                    <StackPanel>
                        <Label Foreground="Red" Content="{Binding ElementName=Holder, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"/>
                    </StackPanel>
                </ControlTemplate>
            </Grid.Resources>
            <StackPanel Margin="0">
                <Grid Height="495">
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,10,0,0" Height="25" Text="Economizer" TextAlignment="Right"/>
                    <RadioButton Content="Yes" HorizontalAlignment="Left" Margin="180,10,0,0" VerticalAlignment="Top" Width="45" GroupName="Economizer" Name="rdbtn_Yes" TabIndex="0" IsChecked="True"/>
                    <RadioButton Content="No" HorizontalAlignment="Left" Margin="240,10,0,0" VerticalAlignment="Top" Width="45" GroupName="Economizer" Name="rdbtn_No" TabIndex="1"/>
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,30,0,0" Height="25" Text="De-Aerator" TextAlignment="Right"/>
                    <RadioButton Content="Yes" HorizontalAlignment="Left" Margin="180,30,0,0" VerticalAlignment="Top" Width="45" GroupName="De-Aerator" Name="rdbtn1_Yes" TabIndex="2" IsChecked="True"/>
                    <RadioButton Content="No" HorizontalAlignment="Left" Margin="240,30,0,0" VerticalAlignment="Top" Width="45" GroupName="De-Aerator" Name="rdbtn1_No" TabIndex="3"/>
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,65,0,0" Height="25" Text="Tag Number" TextAlignment="Right"/>
                    <TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Margin="180,65,0,0" Width="150" FontSize="12" FontFamily="Calibri" Name="txtbx_TagNum" TabIndex="4" />
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,95,0,0" Height="25" Text="Capacity(TPH)" TextAlignment="Right"/>
                    <TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Margin="180,95,0,0" Width="150"  FontSize="12" FontFamily="Calibri" Name="txtbx_Capcity" TabIndex="5" 
                             PreviewTextInput="txtbx_Capcity_PreviewTextInput" Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplate}">
                        <!--<TextBox.Text>
                            <Binding Path="ValueInBox" UpdateSourceTrigger="PropertyChanged">
                                <Binding.ValidationRules>
                                    <DataErrorValidationRule/>
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>-->
                    </TextBox>
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,125,0,0" Height="25" Text="Type Of Boiler" TextAlignment="Right"/>
                    <ComboBox HorizontalAlignment="Left" VerticalAlignment="Top" Margin="180,125,0,0" Width="150"  FontSize="12" FontFamily="Calibri" Name="cmb_TypeBoiler" TabIndex="6" />
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,155,0,0" Height="25" Text="Pressure Of Steam(barG)" TextAlignment="Right"/>
                    <TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Margin="180,155,0,0" Width="150"  FontSize="12" FontFamily="Calibri" Name="txtbx_PressureSteam" TabIndex="7"/>
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,185,0,0" Height="25" Text="Temp Of Steam in Deg.C" TextAlignment="Right"/>
                    <TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Margin="180,185,0,0" Width="150"  FontSize="12" FontFamily="Calibri" Name="txtbx_TempSteam" TabIndex="8"/>
                    <PrpGridCtrl:PrpDataGrid  Height="248" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,240,0,0" Width="641" Name="DtGrd" SelectionChanged="DtGrd_SelectionChanged" CellAdornerIsVisible="True" AllowCheckAnyTime="True">
                        <PrpGridCtrl:PrpDataGrid.Columns>
                            <PrpGridCtrl:PrpColumn CellContentIsClickable="True" Header="Tag Number" FieldName="tagnumber" Width="85" EditType="TextBox"/>
                            <PrpGridCtrl:PrpColumn CellContentIsClickable="True" Header="Capacity" FieldName="capacity" Width="95" EditType="TextBox"/>
                            <PrpGridCtrl:PrpColumn CellContentIsClickable="True" Header="Type Of Boiler" FieldName="typeboiler" Width="95" />
                            <PrpGridCtrl:PrpColumn CellContentIsClickable="True" Header="Pressure Of Steam" FieldName="pressure" Width="120" EditType="TextBox" />
                            <PrpGridCtrl:PrpColumn CellContentIsClickable="True" Header="Temperature Of Steam" FieldName="tempsteam" Width="135" EditType="TextBox"/>
                        </PrpGridCtrl:PrpDataGrid.Columns>
                    </PrpGridCtrl:PrpDataGrid>
          
 
                        <Button Content="Add" HorizontalAlignment="Left" Margin="370,215,0,0" VerticalAlignment="Top" Width="75" TabIndex="10" FontFamily="Calibri" Name="btn_Add" Click="btn_Add_Click"/>
                        <Button Content="Delete" HorizontalAlignment="Left" Margin="460,215,0,0" VerticalAlignment="Top" Width="75" TabIndex="11" FontFamily="Calibri" Name="btn_Del" Click="btn_Del_Click"/>
                        <Button Content="Exit" HorizontalAlignment="Left" Margin="550,215,0,0" VerticalAlignment="Top" Width="75" TabIndex="12" FontFamily="Calibri" Name="btn_Exit" Click="btn_Exit_Click" />
 
                </Grid>
            </StackPanel>
        </Grid>
    </Border>
</UserControl>
 
Posted 28-Jan-13 19:13pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

In Javascript:
 
if (document.getElementsByName("rdbtn_Yes").checked)
 // do something
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100