Soa lab 3

634 views

Published on

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
634
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Soa lab 3

  1. 1. Design :DESIGN CODE :<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"Inherits="_Default" %><!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>Untitled Page</title></head><body> <form id="form1" runat="server"> <div style="height: 640px; width: 850px"> &nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
  2. 2. nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:Label ID="Label1" runat="server" Text="ABC SUPERMARKET"></asp:Label> <br /> <br /> <br /> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:Button ID="Button1" runat="server" style="position: relative; top: 0px; left: 141px" Text="HOME CARE" Width="119px" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:Button ID="Button2" runat="server" style="position: relative; top: 0px; left: 152px"Text="CHOCOLATES" Width="124px" /> <br /> <br /> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ProductConnectionString%>" SelectCommand="SELECT * FROM [homecare]"></asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ProductConnectionString%>" SelectCommand="SELECT * FROM [chocolates]"></asp:SqlDataSource> <asp:GridView ID="GridView1" runat="server" Visible="false"AutoGenerateColumns="False" DataSourceID="SqlDataSource1" style="position: relative; top: 3px; left: 53px; height: 151px;width: 295px"> <Columns> <asp:BoundField DataField="Product_ID" HeaderText="Product_ID" SortExpression="Product_ID" /> <asp:BoundField DataField="Product_Name"HeaderText="Product_Name" SortExpression="Product_Name" /> <asp:BoundField DataField="Product_Price"HeaderText="Product_Price" SortExpression="Product_Price" /> </Columns> </asp:GridView> <asp:GridView ID="GridView2" runat="server" Visible="false"AutoGenerateColumns="False" DataSourceID="SqlDataSource2" style="position: relative; top: 5px; left: 55px; height: 149px;width: 291px"> <Columns> <asp:BoundField DataField="Product_ID" HeaderText="Product_ID" SortExpression="Product_ID" /> <asp:BoundField DataField="Product_Name"HeaderText="Product_Name"
  3. 3. SortExpression="Product_Name" /> <asp:BoundField DataField="Product_Price"HeaderText="Product_Price" SortExpression="Product_Price" /> </Columns> </asp:GridView> </div> </form></body></html>ASPX.VB codingPartial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e AsSystem.EventArgs) Handles Button1.Click SqlDataSource1.SelectCommand = "SELECT * From homecare" GridView1.DataBind() GridView2.Visible = False GridView1.Visible = True End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e AsSystem.EventArgs) Handles Me.Load End Sub Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e AsGridViewCommandEventArgs) Handles GridView1.SelectedIndexChanged Dim rIndex As Integer = CType(e.CommandArgument, Integer) Dim thisID As String = Me.GridView1.DataKeys(rIndex).Value.ToString() Response.Write(thisID)
  4. 4. End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e AsSystem.EventArgs) Handles Button2.Click SqlDataSource1.SelectCommand = "SELECT * From Chocolates" GridView1.DataBind() GridView1.Visible = False GridView2.Visible = True End SubEnd ClassOUTPUT

×