Monday 2 June 2014

asp.net 11: panel

program to demonstrate panel control.

-----------------------------------------DESIGN-----------------------------------------------------
<%@PageLanguage="VB"AutoEventWireup="false"CodeFile="Default.aspx.vb"Inherits="_Default"%>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
<title>Untitled Page</title>
<styletype="text/css">
#form1
        {
height: 66px;
width: 914px;
        }
</style>
</head>
<body>
<formid="form1"runat="server">

<asp:PanelID="Panel1"runat="server"Font-Bold="False"Font-Size="Medium"
GroupingText="Select Any One"Height="73px"Width="571px"
BorderStyle="Double">
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RadioButtonID="RadioButton1"runat="server"Text="Positive-negative"Checked="true"
GroupName="k"AutoPostBack="True"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RadioButtonID="RadioButton2"runat="server"Text="Square"GroupName="k"
AutoPostBack="True"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RadioButtonID="RadioButton3"runat="server"Text="Cube"GroupName="k"
AutoPostBack="True"/>
</asp:Panel>

<br/>
<br/>
<asp:PanelID="Panel2"runat="server"Height="264px"Width="333px"
GroupingText="Positive-Negative"Font-Size="Medium"BorderStyle="Double">

<br/>
<asp:LabelID="Label1"runat="server"Text="Enter value:"></asp:Label>
&nbsp;&nbsp;&nbsp;<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:ButtonID="Button1"runat="server"Text="OK"/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br/>
<asp:LabelID="Label2"runat="server"Text="Ans Is:"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBoxID="TextBox2"runat="server"></asp:TextBox>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</asp:Panel>

</form>
</body>
</html>


-----------------------------------------code---------------------------------------------------------
PartialClass _Default
Inherits System.Web.UI.Page
Dim a AsDouble

ProtectedSub RadioButton1_CheckedChanged(ByVal sender AsObject, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        Panel2.GroupingText = "Positive-Negative"
        TextBox1.Text = ""
        TextBox2.Text = ""

EndSub
ProtectedSub RadioButton2_CheckedChanged(ByVal sender AsObject, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        Panel2.GroupingText = "Square"
        TextBox1.Text = ""
        TextBox2.Text = ""
EndSub

ProtectedSub RadioButton3_CheckedChanged(ByVal sender AsObject, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
        Panel2.GroupingText = "Cube"
        TextBox1.Text = ""
        TextBox2.Text = ""
EndSub

ProtectedSub Button1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles Button1.Click
        a = TextBox1.Text
If RadioButton1.Checked = TrueThen
If (a < 0) Then
                TextBox2.Text = "value is Negative"
ElseIf (a = 0) Then
                TextBox2.Text = "value is Zero"
Else
                TextBox2.Text = "value is Positive"
EndIf
ElseIf RadioButton2.Checked = TrueThen
            TextBox2.Text = a * a
ElseIf RadioButton3.Checked = TrueThen
            TextBox2.Text = a * a * a
EndIf
EndSub

EndClass

-----------------------------------------output----------------------------------------------------


umesh sohaliya
codestrew

No comments:

Post a Comment