Setting DataList EditItemTemplate Properties

S

Stuart Shay

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top