Setting DataList EditItemTemplate Properties

Discussion in 'ASP .Net' started by Stuart Shay, Dec 26, 2004.

  1. Stuart Shay

    Stuart Shay Guest

    Hello All

    I Created a DataList and when the user Selects a Item for Edit, I want to
    change the CssClass TextBox Properties based on if the Item is a Item or
    Alternating Item.

    Item => EditLastName.CssClass = "WhiteBox"
    AlternatingItem => EditLastName.CssClass = "GreyBox"

    How do I set these properties in the ItemBound Event?

    <asp:DataList ....>

    <EditItemTemplate>
    <asp:LinkButton runat="server" Text="Update" CommandName="Update"
    ID="Linkbutton1" />
    <asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel"
    ID="Linkbutton2" />
    <asp:DropDownList runat="server" ID="EditTitle" DataSource='<%#
    TitlesOfCourtesy %>' SelectedIndex='<%#
    GetSelectedTitle(DataBinder.Eval(Container.DataItem, "TitleOfCourtesy")) %>'
    />
    <asp:TextBox runat="server" ID="EditLastName" Text='<%#
    DataBinder.Eval(Container.DataItem, "LastName") %>' />
    <asp:TextBox runat="server" ID="EditFirstName" Text='<%#
    DataBinder.Eval(Container.DataItem, "FirstName") %>' />
    </EditItemTemplate>

    </asp:DataList>


    Thanks
    Stuart
     
    Stuart Shay, Dec 26, 2004
    #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. SStory

    Datalist EditItemTemplate

    SStory, Aug 19, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    510
    SStory
    Aug 19, 2003
  2. Steve Lloyd
    Replies:
    1
    Views:
    720
    Rick Spiewak
    May 26, 2004
  3. Nevyn Twyll
    Replies:
    8
    Views:
    1,964
  4. Luis Esteban Valencia
    Replies:
    1
    Views:
    502
    John Saunders
    Jan 6, 2005
  5. Replies:
    1
    Views:
    1,803
    Grant Merwitz
    Sep 27, 2005
Loading...

Share This Page