0% found this document useful (0 votes)
27 views11 pages

AWP Practical

Advance programming Practical

Uploaded by

jaishwaljaishi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views11 pages

AWP Practical

Advance programming Practical

Uploaded by

jaishwaljaishi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Advanced Web Programming

Practical #4
Name Shafaque khan Roll Number 22302B0049
Subject/Course: Advanced Web Development Technologies
Topic Working with web form controls

1. Write the program for the following:

a) Create a Registration form to demonstrate use of various Validation controls.


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

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

protected void Button1_Click(object sender, EventArgs e)


{

protected void TextBox2_TextChanged(object sender, EventArgs e)


{

protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)


{
string str = args.Value;
args.IsValid = false;
if(str.Length < 6 || str.Length >)
{
return;
}
}
}

Vidyalankar School of Information Technology


}

Vidyalankar School of Information Technology


b) Create Web Form to demonstrate use of Adrotator Control.
(Ad.xml file)
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>image/img1.png</ImageUrl>
<NavigateUrl>about.aspx</NavigateUrl>
<AlternateText>Otrder books</AlternateText>
<Impressions>20</Impressions>
</Ad>

<Ad>
<ImageUrl>image/img2.png</ImageUrl>
<NavigateUrl>about.aspx</NavigateUrl>
<AlternateText>Order books</AlternateText>
<Impressions>20</Impressions>
</Ad>

<Ad>
<ImageUrl>image/img3.png</ImageUrl>
<NavigateUrl>about.aspx</NavigateUrl>
<AlternateText>Otrder books</AlternateText>
<Impressions>20</Impressions>

</Ad>
</Advertisements>
(adrotator)

Vidyalankar School of Information Technology


OUTPUT

Vidyalankar School of Information Technology


Vidyalankar School of Information Technology
c) Create Web Form to demonstrate use User Controls.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="login.ascx.cs" Inherits="Practical_43.login" %>

<h3>This is a User Control</h3>

<table>

<tr>

<td>Name:</td>

<td>

<asp:TextBox ID="txtName" runat="server"></asp:TextBox>

</td>

Vidyalankar School of Information Technology


<td>

&nbsp;</td>

</tr>

<tr>

<td>City:</td>

<td>

<asp:TextBox ID="txtCity" runat="server"></asp:TextBox>

</td>

</tr>

<tr>

<td>

<br />

<asp:Button ID="txtSave" runat="server" OnClick="Button1_Click" Text="Save" />

<br />

<br />

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

</td>

</tr>

</table>

Vidyalankar School of Information Technology


using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace Practical_43

public partial class login : System.Web.UI.UserControl

protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)

Vidyalankar School of Information Technology


{

Label1.Text = "Your Name is " + txtName.Text + " and you are from " + txtCity.Text;

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserControlInherit.aspx.cs"


Inherits="Practical_43.UserControlInherit" %>

<%@ Register Src="~/login.ascx" TagPrefix="uc1" TagName="login" %>

<!DOCTYPE html>

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

<head runat="server">

<title></title>

</head>

<body>

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

<div>

<uc1:login runat="server" ID="login" />

</div>

Vidyalankar School of Information Technology


</form>

</body>

</html>

Vidyalankar School of Information Technology


Vidyalankar School of Information Technology

You might also like