Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Advanced Web Programming

Practical #8
Name Sayed Fardeen Roll Number 20302D3004
Subject/Course: Advanced Web Programming
Topic Using DLL

DLL
Design a web page which includes one Text Box and two buttons, which are named as UPPER CASE and
LOWER CASE. The text will be entered in the text box and then depending upon the button clicked the
text in the text box will be changed to either upper case or lower case. The code to convert the text to
either case should be written in a DLL file called as DLLClassLibrary.
Steps:
Step1.Open Visual Studio & goto to File Menu→New→Project→Class
Library→ChangeNameto→ ULClassLibrary →Ok.
Step 2. Write the following code to Class1.cs file. using System;
namespace ULClassLibrary
{
public class Class1
{
public String UpperCase(String text)
{
return text.ToUpper();
}
public String LowerCase(String text)
{
return text.ToLower();
}
}
}
Step 3: Now click Build Menu→Build Solution to complete the process of dll file creation in
your application/Bin/Debug folder.
Step 4: Now create new Website and then rightclick on website→AddRefrence→Browse and
select ULClassLibrary/Bin/debug/ ULClassLibrary.dll →Ok.
Step 5: Now add new web page in the website and design as given below:
Step 6: Add following code in .aspx file:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pract8.aspx.cs" Inherits="pract8.pract8"
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
Vidyalankar School of Information Technology
<form id="form1" runat="server">
<div>
&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
&nbsp;&nbsp;
&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server" Text="UpperCase" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="LowerCase" />
</div>
</form>
</body>
</html>
Step 7: Add following code in .aspx.cs file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ULClassLibrary;
namespace pract8
{
public partial class pract8 : System.Web.UI.Page
{
Class1 c = new Class1();
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = c.UpperCase(TextBox1.Text);
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = c.LowerCase(TextBox1.Text);
}
}
}
Step 8: Now run the page.
Browser Output:

Vidyalankar School of Information Technology


Vidyalankar School of Information Technology

You might also like