Tuesday 9 August 2016

Write a program to display reverse of string in ASP.NET

This post will help you to demonstrate a program to display the reverse of a string in ASP.NET. You can copy this code after you open a blank project in IDE of ASP.NET(Visual Studio). Then try to run that copied code, at that time you will get an expecting output.

In this program we are trying to find reverse of a string that we entered in text-box. For this, we used one text-box and one label to print output, and a button to perform this function. There you can see these text-box and a button also in the output. But the label will be hidden, it will only visible after you try to find the output.Then enter any string that you want to check its reverse, after that click on the button. Then you will get the output. The output will be reverse of the string that you have entered in the text-box field. We hope this code will help you to be a developer or a programmer. Before copying, try to understand the method that we used to find the output. Click on the read more button to get this code.

Monday 8 August 2016

Write a program to bind data to dropdown using aspx.cs page in ASP.NET

This post will help you to demonstrate a program to bind data to drop-down using aspx.cs page  in ASP.NET. You can copy this code after you open a blank project in IDE of ASP.NET (Visual Studio). Then try to run that copied code, at that time you will get an expecting output. In this program we are trying to bind data to drop-down using aspx.cs page. For this, we used one dropdownlist and one label to print output, and a button to perform this function. There you can see these drop-down and a button also in the output. The label will show as "The result will shown here", it will change after you try to change the value of drop-down in the output.Select any option from that drop-down, after that click on the button. Then you will get the output on the label. The options are added using aspx.cs page. We hope this code will help you to be a developer or a programmer. Before copying, try to understand the method that we used to find the output. Click on the read more button to get this code.

Sunday 7 August 2016

write a program to display table controls in asp.net

tablecontrol.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="tablecontrol.aspx.cs" Inherits="our_program.tablecontrol" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    
    <form id="form1" runat="server">
<center>
    <div>
    <asp:Table ID="Table1" runat="server">
    <asp:TableHeaderRow><asp:TableCell>username</asp:TableCell>
    <asp:TableCell >address</asp:TableCell>
    <asp:TableCell>gender</asp:TableCell>
    <asp:TableCell>place</asp:TableCell>
    </asp:TableHeaderRow>
    <asp:TableRow><asp:TableCell>shafi</asp:TableCell>
    <asp:TableCell>shafi</asp:TableCell>
    <asp:TableCell>shafi</asp:TableCell>
    <asp:TableCell>shafi</asp:TableCell>

    </asp:TableRow>
<asp:TableRow>
<<asp:TableCell>pa</asp:TableCell>

</asp:TableRow>
    </asp:Table>
    
   </div>
    </form>
</body>
</html>

tablecontrol.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class tablecontrol : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

Saturday 6 August 2016

write a program to check entered number is between 1 and 100 using range validator in asp.net

range_validator.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="range_validator.aspx.cs" Inherits="our_program.range_validator" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Range validator</title>
    <center><h1>Range validator</h1></center>
    <script runat="server">

      void btnclick(Object sender, EventArgs e)
      {

         if (Page.IsValid)
         {
             lbl.Text = "entered value is between 1 and 100 Page is valid.";
         }
         else
         {
            lbl.Text="entered value is between 1 and 100 Page is not valid!!";
         }

      }

   </script>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
   
    <asp:TextBox ID="txt1" runat="server"></asp:TextBox>
    <br />
    <br />
   
    <asp:RangeValidator ID="RangeValidator1" runat="server"
        ErrorMessage="RangeValidator" MaximumValue="100" MinimumValue="1" ControlToValidate="txt1" Type="Integer" EnableClientScript="false" Text="please enter value between 1 and 100"></asp:RangeValidator>
    <asp:Label ID="lbl" runat="server" Text=""></asp:Label>
    <br />
    <br />
    <asp:Button  ID="btn" runat="server" Text="submit" OnClick="btnclick"/>
    </div>
    </center>
    </form>
</body>
</html>


range_validator.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class range_validator : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

write a program to display prime numbers in a range in asp.net

primerange.aspx.cs

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="primerange.aspx.cs" Inherits="our_program.primerange" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <center><h1>prime in a range</h1></center>
</head>
<body>
    <form id="form1" runat="server">
     <center>
    <div>
     
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:TextBox ID="txt1" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click"  />
    <br />
    <br />
    <asp:Label ID="lbl" runat="server" Text="result are shown here"></asp:Label>
   

   
    </div>
    </center>
    </form>
</body>
</html>

primerange.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class primerange : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            int l = Convert.ToInt16(txt.Text);
            int u = Convert.ToInt16(txt1.Text);
            string output = "";
            int a = l + 1;
            for (int i = a; i < u; i++)
            {
                int f = 0;
                for (int j = 2; j < i; j++)
                {
                    if (i % j == 0)
                    {
                        f = 1;
                        break;
                    }
                }
                if (f == 0)
                {
                    output = output + "<br>" + i;
                }
            }
            lbl.Text = "prime numbers b/w " + l + " and " + u + " are " + output;

        }
    }
}

write a program to display odd numbers in a range in asp.net

oddrange.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="oddrange.aspx.cs" Inherits="our_program.oddrange" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>odd in a range</title>
    <center><h1>odd in a range</h1></center>
</head>
<body>

    <form id="form1" runat="server">
    <center>
    <div>
       
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:TextBox ID="txt1" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click"  />
<br />
    <br />
    <asp:Label ID="lbl" runat="server" Text="result are shown here"></asp:Label>
   

    </div>
    </center>
    </form>
</body>
</html>

oddrange.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class oddrange : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            int l = Convert.ToInt16(txt.Text);
            int u = Convert.ToInt16(txt1.Text);
            string output = "";
            int a = l+1;
            for (int i = a; i < u; i++)
            {
                if (i % 2 == 1)
                {
                    output = output + "<br>" + i;
                }
            }
            lbl.Text = "Odd numbers b/w " + l + " and " + u + " are " + output;

        }
    }
}

write a program to display N prime numbers in asp.net

N_prime.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="N_prime.aspx.cs" Inherits="our_program.N_prime" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>N prime number</title>
    <center><h1>N prime numbers</h1></center>
</head>
<body>
    <form id="form1" runat="server">
     <center>
    <div>
     
        <asp:TextBox ID="txt" runat="server"></asp:TextBox>
        <br />
        <br />
        <asp:Button ID="bt" runat="server" Text="Button" onclick="bt_Click"  />
        <br />
        <br />
        <asp:Label ID="lbl" runat="server" Text="result are shown here"></asp:Label>
   

    </div>
    </center>
    </form>
</body>
</html>

N_prime.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class N_prime : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void bt_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt16(txt.Text);
            int prime = 0;
            int l = n * 2;
            string output = "";
            for (int i = 2; i < n * 4; i++)
            {
                int f = 0;
                for (int j = 2; j < i; j++)
                {
                    if (i % j == 0)
                    {
                        f = 1;
                        break;
                    }
                }
                if (f == 0)
                {
                    output = output + "<br>" + i;
                    prime++;
                }
                if (prime == n)
                {
                    break;
                }
            }
            lbl.Text = "prime numbers are " + output;
        

        }
    }
}

write a program to display N odd numbers in asp.net

N_odd.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="N_odd.aspx.cs" Inherits="our_program.N_odd" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>N odd numbers</title>
    <center><h1>N odd numbes</h1></center>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
         <asp:TextBox ID="txt" runat="server"></asp:TextBox>
         <br />
         <br />
        <asp:Button ID="bt" runat="server" Text="Button" onclick="bt_Click"  />
        <br />
        <br />
        <asp:Label ID="lbl" runat="server" Text="result are shown here"></asp:Label>

    </div>
    </center>
    </form>
</body>
</html>

N_odd.asp.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class N_odd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void bt_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt16(txt.Text);
            int even = 0;
            int j = n * 2;
            string output = "";
            for (int i = 0; i < n * 4; i++)
            {
                if (i % 2 == 1)
                {
                    output = output + "<br>" + i;
                    even++;
                } j = j * 2;
                if (even == n)
                {
                    break;
                }
            }
            lbl.Text = "odd numbers are " + output;
        

        }
    }
}

write a program to display N_fibonacci in asp.net

N_fibonacci.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="N_fibonacci.aspx.cs" Inherits="our_program.N_fibonacci" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>N fibonacci number</title>
    <center><h1>N fibonacci number</h1></center>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
        <asp:TextBox ID="txt" runat="server"></asp:TextBox>
        <br />
        <br />
        <asp:Button ID="bt" runat="server" Text="Button" onclick="bt_Click"  />
        <br />
        <br />
        <asp:Label ID="lbl" runat="server" Text="result are shown here"></asp:Label>
     </div>
    </center>
    </form>
</body>
</html>

N_fibonacci.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class N_fibonacci : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void bt_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt16(txt.Text);
            int fib = 0, a = 0, s = 1, d = 1;
            int j = n * 2;
            string output = "";
            for (int i = 0; i < n * 4; i++)
            {
                a = s; s = d;
                output = output + "<br>" + d;
                fib++;
                d = a + s;
                j = j * 2;
                if (fib == n)
                {
                    break;
                }
            }
            lbl.Text = n + " fib0nacci numbers are " + output;
        

        }
    }
}

write a program to display N even numbers in asp.net

N_even.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="N_even.aspx.cs" Inherits="our_program.N_even" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>N even number</title>
    <center><h1>N even number</h1></center>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
        <asp:TextBox ID="txt" runat="server"></asp:TextBox>
        <br />
        <br />
    <asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click" />
    <br />
    <br />
    <asp:Label ID="lbl" runat="server" Text="result are shown here"></asp:Label>

    </div>
    </center>
    </form>
</body>
</html>

N_even.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class N_even : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt16(txt.Text);
            int even = 0;
            int j = n * 2;
            string output = "";
            for (int i = 1; i < n * 4; i++)
            {
                if (i % 2 == 0)
                {
                    output = output + "<br>" + i;
                    even++;
                } j = j * 2;
                if (even == n)
                {
                    break;
                }
            }
            lbl.Text = "Even numbers are " + output;

        }
    }
}

write a program to display fibonacci in range in asp.net



fibonacci_in_range.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="fibonacci_in_range.aspx.cs" Inherits="our_program.fibonacci_in_range" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>fibonacci in range</title>
    <center><h1>fibonacci in range</h1></center>
</head>
<body>
    <form id="form1" runat="server">
   <center>
    <div>
        <asp:TextBox ID="txt" runat="server"></asp:TextBox>
        <br />
        <br />
    <asp:TextBox ID="txt1" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click" />
    <br />
    <br />
    <asp:Label ID="lbl" runat="server" Text="result are shown here"></asp:Label>

    </div>
    </center>
    </form>

</body>
</html>

fibonacci_in_range.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class fibonacci_in_range : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            int l = Convert.ToInt16(txt.Text);
            int u = Convert.ToInt16(txt1.Text);
            int a = 0, s = 1, d = 1, f = 10;
            string output = "";
            for (int i = 0; i < f * 4; i++)
            {
                a = s; s = d;
                if (d > l && d < u)
                {
                    output = output + "<br>" + d;
                }
                d = a + s;
                f = f * 2;
            }
            lbl.Text = " fibonacci numbers b/w " + l + " and " + u + " are " + output;

        }
    }
}

write a program to display even numbers in a range in asp.net

evenrange.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="evenrange.aspx.cs" Inherits="our_program.evenrange" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>even number in a range</title>
    <center><h1>even number in a range</h1></center>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:TextBox ID="txt1" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click" />
    <br />
    <br />
    <asp:Label ID="lbl" runat="server" Text="result will shown here"></asp:Label>

    </div>
    </center>
    </form>
</body>
</html>

evenrange.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class evenrange : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            int l = Convert.ToInt16(txt.Text);
            int u = Convert.ToInt16(txt1.Text);
            string output = "";
            int a = l + 1;
            for (int i = a; i < u; i++)
            {
                if (i % 2 == 0)
                {
                    output = output + "<br>" + i;
                }
            }
            lbl.Text = "Even numbers b/w " + l + " and " + u + " are " + output;

        }
    }
}

write a program to check given number is prime or not in asp.net

checkprime.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="checkprime.aspx.cs" Inherits="our_program.checkprime" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Check Prime Number</title>
    <center><h1>Check Prime Number</h1></center>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click" />
    <br />
    <br />
    <asp:Label ID="lbl" runat="server" Text="result will shown here"></asp:Label>

    </div>
    </center>
    </form>
</body>
</html>

checkprime.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class checkprime : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt16(txt.Text);
            int l = n * 2;
            string output = "";
            int f = 0;
            for (int j = 2; j < n; j++)
            {
                if (n % j == 0)
                {
                    f = 1;
                    break;
                }
            }
            if (f == 0)
            {
                output = "The given number " + n + " is Prime";
            }
            else
            {
                output = "The given number " + n + " is not Prime";
            }
            lbl.Text = output;
       

        }
    }
}

Thursday 4 August 2016

write a program to check odd or not in asp.net

checkodd.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="checkodd.aspx.cs" Inherits="our_program.checkodd" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>check odd or not</title>
    <center><h1>check odd or not</h1></center>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
     <br />
    <br />
    <asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click"   />
    <br />
    <br />
    <asp:Label ID="lbl" runat="server" Text="result are shown here"></asp:Label>

    </div>
    </center>
    </form>
</body>
</html>

checkodd.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class checkodd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt16(txt.Text);
            string output = "";
            if (n % 2 == 1)
            {
                output = "The given number " + n + " is Odd";
            }
            else
            {
                output = "The given number " + n + " is not Odd";
            }
            lbl.Text = output;
  
        
        }
    }
}

write a program to check febinocci or not in asp.net

checkodd.asx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="checkodd.aspx.cs" Inherits="our_program.checkodd" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>check odd or not</title>
    <center><h1>check odd or not</h1></center>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
     <br />
    <br />
    <asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click"   />
    <br />
    <br />
    <asp:Label ID="lbl" runat="server" Text="result are shown here"></asp:Label>

    </div>
    </center>
    </form>
</body>
</html>

checkodd.asx.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class checkodd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt16(txt.Text);
            string output = "";
            if (n % 2 == 1)
            {
                output = "The given number " + n + " is Odd";
            }
            else
            {
                output = "The given number " + n + " is not Odd";
            }
            lbl.Text = output;
  
        
        }
    }
}

write a program to check febinocci or not in asp.net

febinocci.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="febinocci.aspx.cs" Inherits="our_program.febinocci" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <title>check febinocci or not</title>
    <center><h1>check febinocci or not</h1></center>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click"  />
    <br />
    <br />
    <asp:Label ID="lbl" runat="server" Text=""></asp:Label>

    </div>
    </center>
    </form>
</body>
</html>

febinocci.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class febinocci : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt16(txt.Text);
            int a = 0, s = 1, d = 1;
            int j = n * 2;
            string output = "";
            for (int i = 0; i < j; i++)
            {
                a = s; s = d;
                d = a + s;
                j = j * 2;
                if (n == d)
                {
                    break;
                }
            }
            if (n == d)
            {

             output = "The numbers " + n + " is Fibonacci";
            }
            else
            {
                output = "The numbers " + n + " is not Fibonacci";
            }
            lbl.Text = output;
        }


        }
    }

write a program to check even or not in asp.net

check_even.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="check_even.aspx.cs" Inherits="our_program.check_even" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>check even or not</title>
    <center><h1>check even or not</h1></center>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click"/>
    <br />
    <br />
    <asp:Label ID="lbl" runat="server" Text="result are shown here"></asp:Label>

    </div>
    </center>
    </form>
</body>
</html>

check_even.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class check_even : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt16(txt.Text);
            string output = "";
         if (n % 2 == 0)
                {
                    output = "The given number " + n + " is Even";
                } else
                {
                    output = "The given number " + n + " is not Even";
                }
            lbl.Text = output;
        }


        }
    }

write a program to check palindrom or not in asp.net

palindrom.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="palindrom.aspx.cs" Inherits="our_program.palindrom" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Palindrom</title>
    <center><h1>Palindrom</h1></center>
</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Label ID="lbl" runat="server" Text="palindrom or not"></asp:Label>
    <br />
    <br />
    <asp:Button ID="btn" runat="server"  Text="submit" onclick="btn_Click"/>
    </div>
    </center>
    </form>
</body>
</html>

palindrom.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace our_program
{
    public partial class palindrom : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            string a = txt.Text;
            string output = "";
            int v = a.Length - 1;
            char[] array = a.ToCharArray();
            for (int i = v; i >= 0;i-- )
            {
                output = output + array[i].ToString();
            }
            if (output == a)
            {
                lbl.Text = a + "  this is palindrom";
            }
            else
            {
                lbl.Text = a + "this is not palindrom";
            }

        }
    }
}