Unlocking the World of Business Intelligence with SQLBI

Image
Introduction : ·         In the current data-centric world, Business Intelligence (BI) is integral to transforming raw data into actionable insights, guiding organizations toward informed decision-making.  ·         Among the prominent educational platforms for mastering BI,  SQLBI  stands out for its focus on Microsoft technologies like Power BI, DAX (Data Analysis Expressions), and SSAS Tabular.  ·         This guide delves deep into how SQLBI can serve as an invaluable educational resource, helping both educators and learners build practical and theoretical knowledge of BI. What is SQLBI? ·         SQLBI is an educational platform dedicated to the study and application of Business Intelligence, particularly focused on Microsoft technologies. ·         Founded by renowned experts M...

ASP.net Server Controls Part-1

 

v  LABLE:

o   In ASP.NET, a Label control is a server-side web control used to display text on a web page. It is commonly used to show static text or text generated dynamically from server-side code.

o   The Label control does not allow user input but is ideal for displaying messages, instructions, or data.

 

o   Basic Properties of Label Control:

§  Text: Specifies the text displayed by the Label.

§  ID: Assigns a unique identifier to the Label control, which can be used to reference it in code.

§  CssClass: Defines the CSS class for styling the Label.

§  ForeColor: Sets the color of the text displayed by the Label.

§  Font-Bold: Determines whether the text should be bold.

§  Font-Italic: Determines whether the text should be italicized.

§  Font-Underline: Determines whether the text should be underlined.

§  Width: Sets the width of the Label control.

§  Height: Sets the height of the Label control.

§  EnableViewState: Determines whether the Label control maintains its state across postbacks.

 

o   Example:

§  Here’s an example of how to use a Label control in an ASP.NET Web Forms page.

§  ASPX Markup (Frontend):

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

 

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Label Control Example</title>

    <style>

        .custom-label {

            color: blue;

            font-weight: bold;

            font-size: 16px;

        }

    </style>

</head>

<body>

    <form id="form1" runat="server">

        <div>

            <asp:Label ID="lblMessage" runat="server" Text="Welcome to       ASP.NET!" CssClass="custom-label" />

            <br />

            <asp:Button ID="btnChangeText" runat="server" Text="Change Text" OnClick="btnChangeText_Click" />

        </div>

    </form>

</body>

</html>

 

§  C# Code-Behind (Backend):

using System;

 

namespace YourNamespace

{

    public partial class Default : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            // This is where you can perform operations when the page is first loaded

        }

 

        protected void btnChangeText_Click(object sender, EventArgs e)

        {

            lblMessage.Text = "Text changed by button click!";

        }

    }

}

 

v  BUTTON:

o   The Button control in ASP.NET Web Forms is a server-side control that allows users to initiate actions when they click it.

o   It is commonly used to submit forms, trigger server-side events, and execute code.

 

o   Basic Properties of Button Control:

§  Text: Specifies the text displayed on the button.

§  ID: Provides a unique identifier for the Button control, used to reference it in the code-behind.

§  CssClass: Assigns a CSS class for styling the Button control.

§  OnClick: Specifies the name of the event handler method that will be executed when the button is clicked.

§  Enabled: Determines whether the button is enabled or disabled.

§  CausesValidation: Indicates whether the button causes validation of the controls on the page when clicked.

§  CommandName: Defines the command name associated with the button, often used with command-based events.

§  CommandArgument: Provides an argument that can be used with the CommandName property.

§  ImageUrl: Sets the URL of an image to be displayed on the button (if using an image button).

o   Example:

§  Here’s a basic example of using a Button control in an ASP.NET Web Forms page:

 

§  ASPX Markup (Frontend):

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

 

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Button Control Example</title>

    <style>

        .custom-button {

            background-color: #4CAF50;

            color: white;

            border: none;

            padding: 10px 20px;

            text-align: center;

            text-decoration: none;

            display: inline-block;

            font-size: 16px;

            margin: 4px 2px;

            cursor: pointer;

        }

    </style>

</head>

<body>

    <form id="form1" runat="server">

        <div>

            <asp:Button ID="btnSubmit" runat="server" Text="Submit" CssClass="custom-button" OnClick="btnSubmit_Click" />

            <asp:Button ID="btnReset" runat="server" Text="Reset" CssClass="custom-button" OnClick="btnReset_Click" />

        </div>

    </form>

</body>

</html>

 

§  C# Code-Behind (Backend):

using System;

 

namespace YourNamespace

{

    public partial class Default : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            // This is where you can perform operations when the page is first loaded

        }

 

        protected void btnSubmit_Click(object sender, EventArgs e)

        {

            // Code to handle the submit button click event

            // For example, display a message or perform a server-side action

            Response.Write("Submit button clicked!");

        }

 

        protected void btnReset_Click(object sender, EventArgs e)

        {

            // Code to handle the reset button click event

            // For example, clear form fields or reset values

            Response.Write("Reset button clicked!");

        }

    }

}

v  TEXTBOX:

o   In ASP.NET Web Forms, the TextBox control is a server-side control used to accept and display user input.

o   It is widely used for gathering text input from users, such as names, email addresses, and other data.

 

o   Basic Properties of TextBox Control:

 

§  Text: Specifies the text displayed or entered in the TextBox.

§  ID: Assigns a unique identifier to the TextBox control, which is used to reference it in code-behind.

§  CssClass: Defines the CSS class for styling the TextBox.

§  MaxLength: Sets the maximum number of characters that can be entered in the TextBox.

§  TextMode: Determines the type of input allowed (e.g., single-line text, multi-line text, password). Options include:

·        SingleLine: Default; for a single line of text.

·        MultiLine: For multiple lines of text (similar to a textarea).

·        Password: Hides the text input (useful for password fields).

§  ReadOnly: Indicates whether the TextBox is read-only (i.e., users cannot modify its content).

§  Enabled: Determines whether the TextBox is enabled or disabled.

§  Width: Sets the width of the TextBox control.

§  Height: Sets the height of the TextBox control (for multi-line mode).

 

o   Example:

§  Here's an example of how to use a TextBox control in an ASP.NET Web Forms page:

§  ASPX Markup (Frontend):

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

 

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>TextBox Control Example</title>

    <style>

        .custom-textbox {

            border: 1px solid #ccc;

            padding: 5px;

            width: 200px;

        }

        .multi-line-textbox {

            height: 100px;

        }

    </style>

</head>

<body>

    <form id="form1" runat="server">

        <div>

            <asp:TextBox ID="txtSingleLine" runat="server" CssClass="custom-textbox" Text="Enter text here" />

            <br />

            <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" CssClass="custom-textbox" />

            <br />

            <asp:TextBox ID="txtMultiLine" runat="server" TextMode="MultiLine" CssClass="custom-textbox multi-line-textbox" />

            <br />

            <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />

        </div>

    </form>

</body>

</html>

 

§  C# Code-Behind (Backend)

using System;

 

namespace YourNamespace

{

    public partial class Default : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            // This is where you can perform operations when the page is first loaded

        }

 

        protected void btnSubmit_Click(object sender, EventArgs e)

        {

            // Retrieve text from the TextBox controls

            string singleLineText = txtSingleLine.Text;

            string passwordText = txtPassword.Text;

            string multiLineText = txtMultiLine.Text;

 

            // Process the retrieved text

            // For example, display the text or save it to a database

            Response.Write($"Single Line Text: {singleLineText}<br />");

            Response.Write($"Password: {passwordText}<br />");

            Response.Write($"Multi-Line Text: {multiLineText}");

        }

    }

}

 

v  LINKBUTTON:

o   In ASP.NET Web Forms, the LinkButton control is a server-side control that renders as a hyperlink.

o   It is often used to perform server-side operations when clicked, similar to a button, but it appears as a link.

o   This control is particularly useful for actions that you want to look like a link rather than a traditional button.

 

o   Basic Properties of LinkButton Control:

§  Text: Specifies the text displayed as the link.

§  ID: Provides a unique identifier for the LinkButton control, which is used to reference it in the code-behind.

§  CssClass: Defines the CSS class for styling the LinkButton.

§  OnClick: Specifies the name of the event handler method that will be executed when the LinkButton is clicked.

§  Enabled: Determines whether the LinkButton is enabled or disabled.

§  CommandName: Defines the command name associated with the LinkButton, often used with command-based events.

§  CommandArgument: Provides an argument that can be used with the CommandName property.

§  NavigateUrl: Specifies the URL to navigate to when the LinkButton is clicked. This property is not commonly used with LinkButton as it’s primarily used for server-side event handling.

 

o   Example:

§  Here's an example of how to use a LinkButton control in an ASP.NET Web Forms page:

§  ASPX Markup (Frontend):

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

 

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>LinkButton Control Example</title>

    <style>

        .custom-linkbutton {

            color: blue;

            text-decoration: underline;

            cursor: pointer;

        }

    </style>

</head>

<body>

    <form id="form1" runat="server">

        <div>

            <asp:LinkButton ID="lnkButton" runat="server" Text="Click Me" CssClass="custom-linkbutton" OnClick="lnkButton_Click" />

            <br />

            <asp:LinkButton ID="lnkButtonWithCommand" runat="server" Text="Command Button" CommandName="MyCommand" CommandArgument="123" CssClass="custom-linkbutton" OnClick="lnkButtonWithCommand_Click" />

        </div>

    </form>

</body>

</html>

 

§  C# Code-Behind (Backend)

using System;

 

namespace YourNamespace

{

    public partial class Default : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            // This is where you can perform operations when the page is first loaded

        }

 

        protected void lnkButton_Click(object sender, EventArgs e)

        {

            // Code to handle the LinkButton click event

            Response.Write("LinkButton clicked!");

        }

 

        protected void lnkButtonWithCommand_Click(object sender, EventArgs e)

        {

            // Code to handle the LinkButton with CommandName click event

            LinkButton linkButton = (LinkButton)sender;

            string commandName = linkButton.CommandName;

            string commandArgument = linkButton.CommandArgument;

 

            Response.Write($"Command Name: {commandName}<br />");

            Response.Write($"Command Argument: {commandArgument}");

        }

    }

}

 

v  HYPERLINK:

o   In ASP.NET Web Forms, the HyperLink control is a server-side control used to create hyperlinks that navigate to other pages or resources when clicked.

o   Unlike the LinkButton, which is primarily used for server-side event handling, the HyperLink control is intended for client-side navigation.

 

o   Basic Properties of HyperLink Control:

§  Text: Specifies the text displayed for the hyperlink.

§  NavigateUrl: Defines the URL to which the hyperlink will navigate.

§  Target: Specifies where to open the linked document. Values can include _blank (new window or tab), _self (same frame), _parent, and _top.

§  CssClass: Assigns a CSS class for styling the HyperLink.

§  ToolTip: Provides additional information when the user hovers over the link.

§  NavigateUrl: The URL or path of the resource that the hyperlink points to.

§  ImageUrl: Displays an image as the hyperlink instead of text. This property is used if you want the hyperlink to be represented as an image.

 

o   Example:

§  Here's an example of how to use a HyperLink control in an ASP.NET Web Forms page:

 

§  ASPX Markup (Frontend):

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

 

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>HyperLink Control Example</title>

    <style>

        .custom-hyperlink {

            color: blue;

            text-decoration: underline;

        }

        .custom-image-link {

            border: none;

        }

    </style>

</head>

<body>

    <form id="form1" runat="server">

        <div>

            <asp:HyperLink ID="hlExample" runat="server" Text="Go to Google" NavigateUrl="https://www.google.com" CssClass="custom-hyperlink" ToolTip="Click to go to Google" />

            <br />

            <asp:HyperLink ID="hlImageLink" runat="server" ImageUrl="~/images/logo.png" NavigateUrl="https://www.example.com" CssClass="custom-image-link" />

        </div>

    </form>

</body>

</html>

 

§  C# Code-Behind (Backend):

§  While the HyperLink control is primarily used for client-side navigation and does not usually require server-side code to function, you might use the code-behind for dynamic URL assignments or additional logic.

§  Here’s how you might set properties dynamically:

 

using System;

 

namespace YourNamespace

{

    public partial class Default : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            // Set HyperLink properties dynamically

            if (!IsPostBack)

            {

                hlExample.NavigateUrl = "https://www.bing.com"; // Change URL dynamically

                hlExample.Text = "Go to Bing"; // Change link text dynamically

 

                hlImageLink.ImageUrl = "~/images/newlogo.png"; // Change image dynamically

                hlImageLink.NavigateUrl = "https://www.newexample.com"; // Change URL dynamically

            }

        }

    }

}


Comments

Popular posts from this blog

ASP.Net Fundamentals

Disk Operating System