Assignment 5

Count for 6 Points

Due date: Nov. 15, 2006

See a sample solution running here!

Use new features such as GridView, DetailsView or FormView in ASP.NET 2.0 to implement the following application. 

You need to download the coffee.mdb database

The physical data model of the database is illustrated in the following: 

The first program should be called suppliers.aspx

 

The second program  is invoked by clicking on a supplier's name from the above page. You need to pass the supplier id and supplier name via URL variable sid and sname.

Name the second program: CoffeesBySupplier.aspx

You can click the "Show a list of supplier" link button to go back to the suppliers.aspx  page. 

The third program is invoked by clicking the "Select" button from the above page.  You need to send the coffeename via a URL variable cname.  The code for taking care of this is:

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

Response.Redirect("CoffeeUpdate.aspx?cname=" & GridView1.SelectedValue  & "&sid=" &   _
                Request.QueryString("sid") & "&sname=" & Request.QueryString("sname")) 

End Sub

 

 

Name the third program: CoffeesbySupplier.aspx

 

You can click the "Show a list of supplier" link button to go back to the suppliers.aspx  page. 

You can click the "Show a list of coffees from the same supplier" link button to go back to the CoffeesBySupplier.aspx  page.  But you need to pass the supplier id and supplier name via URL variable sid and sname.   Hint:  You need to use the sid and sname QueryString variables passed from CoffeesBySupplier.aspx to the third page.  Then you need to set sid and sname as QueryString variables in the PostBackUrl property (it needs to be set up dynamically) of the link button when link back to CoffeesBySupplier.aspx

The code should be placed at the Page_Load event,

It looks like

LinkButton2.PostBackUrl = "CoffeesBySupplier.aspx?sid=" & Request.QueryString("sid") & "&sname=" & Request.QueryString("sname")

    In the CoffeeUpdate.aspx page you should be able to update a coffee's basic information or create a new coffee by click the Update link or New link from the previous screen. .