Today, in this article we will overlook at two main keywords i: e IS and AS functionalities and we will implement practically to understand better.
Now, it's time for us to go and do some practical implementations using these keywords. Let's See how better we can implement and such that it should be also easy to understand. Code Toolbox Requirements:
Complete Code of WebForm1.aspx looks like this:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="AS_and_IS_Keyword_Application.WebForm1" %>
Complete Code of WebForm1.aspx.cs looks like this: using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data.SqlClient;using System.Data; namespace AS_and_IS_Keyword_Application{ public partial class WebForm1 : System.Web.UI.Page { protected void PageLoad(object sender, EventArgs e) { } protected void Button1Click(object sender, EventArgs e) { if (Button1 is Button) { var con = new SqlConnection(@"Data Source=VIJAY-PC\SQLEXPRESS;Initial Catalog=Candidate;Integrated Security=True"); var da = new SqlDataAdapter("Select PersonId, FirstName, LastName, Age from Student", con); var ds = new DataSet(); da.Fill(ds, "s"); GridView1.DataSource = ds; GridView1.DataBind(); Button1.Visible = false; } else { Response.Write("It's Not a Button"); } var y = Button1 as Button; Response.Write(y == null ? "Hello It's not of Type Button" : "<h1><center>Hello It's of Type Button</center></h1>"); } }}
The Output of the Application looks like this: After Button Click: I hope this article is useful for you.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: