Click here to Skip to main content
12,945,800 members (40,592 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi,
Que 1) I have Multiple Radio Buttons in My WPF Application. I have Grouped each two radio button in one group using GroupName. On button click i want give the selected or checked radio button value to Database. Similarly I want to retrieve these value back from database on load.

Que 2) I have textbox in which i will enter certain value, depending on that value items added to datagrid should be restricted
for eg:-If I enter 5 in textbox then only 5 items or rows should be added

Help Me Out.
Thank You In Advance......


<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,30,0,0" Height="25" Text="Economizer" TextAlignment="Right" Name="tx_Economizer"/>
                    <RadioButton Content="Yes" HorizontalAlignment="Left" Margin="180,30,0,0" VerticalAlignment="Top" Width="45" GroupName="Economizer" Name="rdbtn_EcoYes" TabIndex="0" IsChecked="True"/>
                    <RadioButton Content="No" HorizontalAlignment="Left" Margin="240,30,0,0" VerticalAlignment="Top" Width="45" GroupName="Economizer" Name="rdbtn_EcoNo" TabIndex="1"/>
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,50,0,0" Height="25" Text="De-Aerator" TextAlignment="Right" Name="tx_DeAerator"/>
                    <RadioButton Content="Yes" HorizontalAlignment="Left" Margin="180,50,0,0" VerticalAlignment="Top" Width="45" GroupName="De-Aerator" Name="rdbtn_DAetorYes" TabIndex="2" IsChecked="True"/>
                    <RadioButton Content="No" HorizontalAlignment="Left" Margin="240,50,0,0" VerticalAlignment="Top" Width="45" GroupName="De-Aerator" Name="rdbtn_DAetorNo" TabIndex="3"/>
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="250,30,0,0" Height="25" Text="Gas Train" TextAlignment="Right" Name="tx_GasTrain"/>
                    <RadioButton Content="Yes" HorizontalAlignment="Left" Margin="400,30,0,0" VerticalAlignment="Top" Width="45" GroupName="GasTrain" Name="rdbtn_GasTrnYes" TabIndex="4" IsChecked="True"/>
                    <RadioButton Content="No" HorizontalAlignment="Left" Margin="460,30,0,0" VerticalAlignment="Top" Width="45" GroupName="GasTrain" Name="rdbtn_GasTrnNo" TabIndex="5"/>
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="250,30,0,0" Height="25" Text="Scrubber" TextAlignment="Right" Name="tx_Scrubber"/>
                    <RadioButton Content="Yes" HorizontalAlignment="Left" Margin="400,30,0,0" VerticalAlignment="Top" Width="45" GroupName="GasTrain" Name="rdbtn_ScrYes" TabIndex="0" IsChecked="True"/>
                    <RadioButton Content="No" HorizontalAlignment="Left" Margin="460,30,0,0" VerticalAlignment="Top" Width="45" GroupName="GasTrain" Name="rdbtn_ScrNo" TabIndex="1"/>
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="280,10,0,0" Height="25" Text="Type Of Boiler" TextAlignment="Right"/>
                    <RadioButton Content="Fire Tube" HorizontalAlignment="Left" Margin="430,10,0,0" VerticalAlignment="Top" GroupName="typeofboiler" Name="rd_FireTube"/>
                    <RadioButton Content="Water Tube" HorizontalAlignment="Left" Margin="520,10,0,0" VerticalAlignment="Top" GroupName="typeofboiler" Name="rd_WaterTube"/>
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,70,0,0" Height="25" Text="Number Of Boilers" TextAlignment="Right" Name="tx_NoOfBoilers"/>
                    
                    <PrpGridCtrl:PrpDataGrid  Height="212" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,276,0,0" Width="641" Name="DtGrd" 
                                              SelectionChanged="DtGrd_SelectionChanged" CellAdornerIsVisible="True" 
                                              AllowCheckAnyTime="True" IsVirtualizing="False" CellEditingIsEnabled="True" TabIndex="15">
                        <PrpGridCtrl:PrpDataGrid.Columns>
                            <PrpGridCtrl:PrpColumn CellContentIsClickable="True" Header="Tag Number" FieldName="tagnumber" Width="85" EditType="TextBox" IsSizable="False"/>
                            <PrpGridCtrl:PrpColumn CellContentIsClickable="True" Header="Capacity" FieldName="capacity" Width="95" EditType="TextBox" IsSizable="False"/>
                            <PrpGridCtrl:PrpColumn CellContentIsClickable="True" Header="Type Of Boiler" FieldName="typeboiler" Width="95" IsSizable="False"/>
                            <PrpGridCtrl:PrpColumn CellContentIsClickable="True" Header="Pressure Of Steam" FieldName="pressure" Width="120" EditType="TextBox" IsSizable="False"/>
                            <PrpGridCtrl:PrpColumn CellContentIsClickable="True" Header="Temperature Of Steam" FieldName="tempsteam" Width="135" EditType="TextBox" IsSizable="False"/>
                        </PrpGridCtrl:PrpDataGrid.Columns>
                    </PrpGridCtrl:PrpDataGrid>
                           
                        <Button Content="Add" HorizontalAlignment="Left" Margin="370,250,0,0" VerticalAlignment="Top" Width="75" TabIndex="12" FontFamily="Calibri" Name="btn_Add" Click="btn_Add_Click"/>
                        <Button Content="Delete" HorizontalAlignment="Left" Margin="460,250,0,0" VerticalAlignment="Top" Width="75" TabIndex="13" FontFamily="Calibri" Name="btn_Del" Click="btn_Del_Click"/>
                        <Button Content="Exit" HorizontalAlignment="Left" Margin="550,250,0,0" VerticalAlignment="Top" Width="75" TabIndex="14" FontFamily="Calibri" Name="btn_Exit" Click="btn_Exit_Click" />
                                     
                </Grid>
            </StackPanel>
        </Grid>
    </Border>
</UserControl>
 
Posted 31-Jan-13 22:45pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

<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" xmlns:x="#unknown">
<stackpanel>




<stackpanel margin="0">
<grid height="495">

<textblock horizontalalignment="Left" verticalalignment="Top" margin="20,30,0,0" height="25" text="Economizer" textalignment="Right" name="tx_Economizer" />
<radiobutton content="Yes" horizontalalignment="Left" margin="180,30,0,0" verticalalignment="Top" width="45" groupname="Economizer" name="rdbtn_EcoYes" tabindex="0" ischecked="True" />
<radiobutton content="No" horizontalalignment="Left" margin="240,30,0,0" verticalalignment="Top" width="45" groupname="Economizer" name="rdbtn_EcoNo" tabindex="1" />
<textblock horizontalalignment="Left" verticalalignment="Top" margin="20,50,0,0" height="25" text="De-Aerator" textalignment="Right" name="tx_DeAerator" />
<radiobutton content="Yes" horizontalalignment="Left" margin="180,50,0,0" verticalalignment="Top" width="45" groupname="De-Aerator" name="rdbtn_DAetorYes" tabindex="2" ischecked="True" />
<radiobutton content="No" horizontalalignment="Left" margin="240,50,0,0" verticalalignment="Top" width="45" groupname="De-Aerator" name="rdbtn_DAetorNo" tabindex="3" />
<textblock horizontalalignment="Left" verticalalignment="Top" margin="250,30,0,0" height="25" text="Gas Train" textalignment="Right" name="tx_GasTrain" />
<radiobutton content="Yes" horizontalalignment="Left" margin="400,30,0,0" verticalalignment="Top" width="45" groupname="GasTrain" name="rdbtn_GasTrnYes" tabindex="4" ischecked="True" />
<radiobutton content="No" horizontalalignment="Left" margin="460,30,0,0" verticalalignment="Top" width="45" groupname="GasTrain" name="rdbtn_GasTrnNo" tabindex="5" />
<textblock horizontalalignment="Left" verticalalignment="Top" margin="250,30,0,0" height="25" text="Scrubber" textalignment="Right" name="tx_Scrubber" />
<radiobutton content="Yes" horizontalalignment="Left" margin="400,30,0,0" verticalalignment="Top" width="45" groupname="GasTrain" name="rdbtn_ScrYes" tabindex="0" ischecked="True" />
<radiobutton content="No" horizontalalignment="Left" margin="460,30,0,0" verticalalignment="Top" width="45" groupname="GasTrain" name="rdbtn_ScrNo" tabindex="1" />
<textblock horizontalalignment="Left" verticalalignment="Top" margin="280,10,0,0" height="25" text="Type Of Boiler" textalignment="Right" />
<radiobutton content="Fire Tube" horizontalalignment="Left" margin="430,10,0,0" verticalalignment="Top" groupname="typeofboiler" name="rd_FireTube" />
<radiobutton content="Water Tube" horizontalalignment="Left" margin="520,10,0,0" verticalalignment="Top" groupname="typeofboiler" name="rd_WaterTube" />
<textblock horizontalalignment="Left" verticalalignment="Top" margin="20,70,0,0" height="25" text="Number Of Boilers" textalignment="Right" name="tx_NoOfBoilers" />

<prpgridctrl:prpdatagrid height="212" verticalalignment="Top" horizontalalignment="Left" margin="0,276,0,0" width="641" name="DtGrd">
SelectionChanged="DtGrd_SelectionChanged" CellAdornerIsVisible="True"
AllowCheckAnyTime="True" IsVirtualizing="False" CellEditingIsEnabled="True" TabIndex="15">
<prpgridctrl:prpdatagrid.columns>
<prpgridctrl:prpcolumn cellcontentisclickable="True" header="Tag Number" fieldname="tagnumber" width="85" edittype="TextBox" issizable="False" />
<prpgridctrl:prpcolumn cellcontentisclickable="True" header="Capacity" fieldname="capacity" width="95" edittype="TextBox" issizable="False" />
<prpgridctrl:prpcolumn cellcontentisclickable="True" header="Type Of Boiler" fieldname="typeboiler" width="95" issizable="False" />
<prpgridctrl:prpcolumn cellcontentisclickable="True" header="Pressure Of Steam" fieldname="pressure" width="120" edittype="TextBox" issizable="False" />
<prpgridctrl:prpcolumn cellcontentisclickable="True" header="Temperature Of Steam" fieldname="tempsteam" width="135" edittype="TextBox" issizable="False" />











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

Solution 2

<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">

  Permalink  

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,899
CHill60 3,180
Maciej Los 2,453
Jochen Arndt 1,910
ppolymorphe 1,785


Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 14 Feb 2013
Copyright © CodeProject, 1999-2017
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