Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2004, 05:13 PM
Authorized User
 
Join Date: Nov 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default Hyperlink syntax?

In VS.NET - I've found some example code in a file Menu.ascx that contains:
<asp:HyperLink id="HyperLink1" Text='<%# DataBinder.Eval(Container.DataItem, "CategoryName") %>' NavigateUrl='<%# "productslist.aspx?CategoryID=" + DataBinder.Eval(Container.DataItem, "CategoryID") + "&selection=" + Container.ItemIndex %>' runat="server" />

and Menu.ascx.cs contains:

private void Page_Load(object sender, System.EventArgs e) {
// Set the curent selection of list
String selectionId = Request.Params["selection"];

if (selectionId != null) {
MyList.SelectedIndex = Int32.Parse(selectionId);
}
. . . . .
}

In trying to run and debug this code, selectionId is always null, and SelectedIndex is not used anywhere else.

The only place "selection" is used is in the cache statement at the top of the ascx page:
<%@ OutputCache Duration="3600" VaryByParam="selection" %>

Can anyone tell me what this is about?


Sandy
__________________
Sandy
 
Old February 18th, 2004, 05:12 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

One thing you can try is to be more specific with the Request object:

String selectionId = Request.QueryString.Item["selection"];

Is it fair to assume that you are trying this on a page that actually has "selection" in the query string?

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old February 19th, 2004, 09:36 PM
Authorized User
 
Join Date: Nov 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Peter, you answered the question. The code on the cs page was never used. They must have forgotton to clean it out.

Sandy





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink carlos1972 Access VBA 2 November 7th, 2007 10:17 AM
hyperlink kritimehrotra Excel VBA 3 July 24th, 2006 08:32 PM
hyperlink hyperlink sbhandar Classic ASP Basics 6 August 26th, 2004 02:04 AM
Hyperlink viktor26 Classic ASP Basics 0 October 19th, 2003 09:48 AM
Hyperlink CW Classic ASP Databases 5 September 17th, 2003 06:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.