Accessing dropdownlists in a datalist control

Discussion in 'ASP .Net' started by Guest, Aug 15, 2007.

  1. Guest

    Guest Guest

    I am trying to develop a tape management application which tracks backup
    tapes for 3 servers. I need to be able to add new tapes and retire old/bad
    tapes. I also need to track the location of the tapes between three
    locations, the 'In Service Date' of each tape, and number of times each tape
    has been loaded into its server.
    So far I have three tables, one for tape mgmt (serverID, TapeID and 'In
    Service Date'), one for tape status (TapeID, Status, Date) and one for
    retired tapes (TapeID, RetireCode, RetiredBy, Date). I have everything
    working except for the capability of updating the status of the tapes (and
    Retiring tapes, but if I can get this working then I can do it).

    Right now I am using a datalist (so I can display two columns - 50+ tapes at
    a time) to display the tapes for a server depending on which radiobutton
    (autopostback) the user clicks. The datalist has one ItemTemplate.

    < %# PadTapeID(DataBinder.Eval(Container.DataItem,"TapeID")) %>

    <asp:DropDownList ID="ddlTapeStatus" runat="server">
    <asp:ListItem Value="1">Safe</asp:ListItem>
    <asp:ListItem Value="2">Library</asp:ListItem>
    <asp:ListItem Value="3">Iron Mountain</asp:ListItem>
    <asp:ListItem Value="0">Retire</asp:ListItem>
    <%# DateTime.Parse(DataBinder.Eval(Container.DataItem,"In Service
    Date").ToString()).ToShortDateString() %>

    <%# LibraryCount(DataBinder.Eval(Container.DataItem,"TapeID"))%>

    I guess the first question is - am I doing this the best way. Second - if I
    am, how do I access loop over each data row in order to pass the TapeID and
    the dlTapeStatus.SelectedValue to a method which will insert the data into
    the database?
    Guest, Aug 15, 2007
    1. Advertisements

  2. Guest

    Guest Guest

    I added a Label for each of the DataBinder items so now I can possibly get
    the TapeID. Am I on the right track?
    Guest, Aug 15, 2007
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.