Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Enable/Disable Links

Reply
Thread Tools

Enable/Disable Links

 
 
rn5a@rediffmail.com
Guest
Posts: n/a
 
      10-17-2006
In a shopping cart app, assume that a user has placed 4 orders (each
order has a corresponding OrderID which will be unique). When he comes
to MyCart.aspx, by default, the details of his last order he had placed
will be displayed in a DataList. Also assume that the OrderID of the
last order is 13.

The details of the earlier orders placed by a particular user (when the
user places more than 1 order) can be viewed by clicking links. The no.
of links displayed will depend upon how many orders a particular user
has placed i.e. the no. of links displayed will be equal to the total
no. of orders placed by a particular user minus one. I am displaying
these links in a Repeater control.

As per the assumption that a user has placed 4 orders, to view the
details of the previous 3 orders (the details of the last order is
currently displayed to the user), 3 links will be provided to the user
immediately after the DataList. Clicking any of the links will bring
the user back to MyCart.aspx. The URL of the links will have
querystrings, UserID & OrderID, appended at the end of the URL using
which the ASPX page will retrieve records from a DB table. The text of
the links wil be just numbers starting from 1. The links will be sorted
in the ascending order of the OrderID. So in this case, the user will
see 1, 2 & 3 as the links. So for e.g. if the previous 3 OrderIDs of
UserID=15 are 4, 7 & 9, the URL of the 3 links will be

MyCart.aspx?UserID=15&OrderID=4
MyCart.aspx?UserID=15&OrderID=7
MyCart.aspx?UserID=15&OrderID=9

respectively. Clicking link '1' will display the details of OrderID=4.
Similarly, clicking link '2' & link '3' will display the details of
OrderID=7 & OrderID=9 respectively.

Suppose the user clicks link '1'. He is taken to
MyCart.aspx?UserID=15&OrderID=4 which will display the details of
OrderID=4. Under such circumstances, I want that link '1' should no
longer remain a link; it should be just plain text. Next if the user
clicks link '2', the details of the order whose OrderID=7 will be
displayed & link '2' should no longer remain a link but link '1' should
become a link (so that the user can view the details of the order whose
OrderID=4 again, if he wants to). Similarly, if the user clicks link
'3', the details of the order whose OrderID=9 will be displayed & link
'3' should no longer remain a link but link '2' should become a link
(so that the user can view the details of the order whose OrderID=7
again, if he wants to) so on & so forth.

This is where I am getting stuck. How do I enable/disable the links
depending upon which link the user has clicked? Can someone suggest me
how do I accomplish this? I don't have any problems in displaying the
order details in the DataList depending upon which link the user clicks
or in displaying the links in the Repeater. My problem lies in
enabling/disabling the links.

Note that I am retrieving the DB records using a SqlDataReader,
assigning the DataSource property of the Repeater to the SqlDataReader
& finally binding the data to the Repeater using DataBind. The Repeater
control looks like this:

<asp:Repeater ID="rptrLinks" runat="server">
<HeaderTemplate>
<table>
<tr>
</HeaderTemplate>
<ItemTemplate>
<td><a href='MyCart.aspx?UserID=<%= Request.QueryString("UserID")
%>&OrderID=<%# Container.DataItem("OrderID") %>'><%#
Container.ItemIndex + 1 %></a>&nbsp;|&nbsp;</td>
</ItemTemplate>
<FooterTemplate>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update to FAQ - Relative URLs for In-page Links and Links to Notes Garrett Smith Javascript 14 05-26-2009 04:50 PM
FF Crashes on Links within Links Puma Firefox 10 02-17-2009 07:12 PM
Make A Shorter Link - no new links accepted, old links still work. why? Computer Support 7 01-02-2007 09:45 PM
Site Links and Physical WAN Links =?Utf-8?B?RW5mb1BhdWw=?= MCSE 2 03-22-2005 09:23 AM
Exchange Links < Western Cartoon Cards > Exchange Links www.westerncartooncards.ca HTML 2 07-12-2004 07:59 PM



Advertisments