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
|