Enable/Disable Links

Discussion in 'ASP .Net' started by rn5a@rediffmail.com, Oct 17, 2006.

  1. Guest

    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>
    , Oct 17, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aliki

    Enable/disable operation

    Aliki, Sep 27, 2004, in forum: VHDL
    Replies:
    1
    Views:
    521
    ivailokroumov
    Sep 28, 2004
  2. buran
    Replies:
    2
    Views:
    1,811
    buran
    Sep 26, 2003
  3. buran
    Replies:
    0
    Views:
    493
    buran
    Sep 26, 2003
  4. Patrick
    Replies:
    1
    Views:
    649
  5. Enable/Disable Links

    , Oct 17, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    412
Loading...

Share This Page