Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > SelectedItemTemplate is ignored

Thread Tools

SelectedItemTemplate is ignored

Posts: n/a

I have a datalist with the definition for ItemTeplate and
When an item is selected, the background color is changed according to
SelectedItemStyle-BackColor="#66CC66" (= in a datalist's header) but the
definition within < SelectedItemTemplate> is ignored and the < ItemTeplate>
is used.
When an user clicks on a datalist item, the page is navigated to the “url”
and DataList1.SelectedIndex is set up. I think so far it should be OK as
SelectedItemStyle-BackColor is used as expected. But why is not used
<SelectedItemTemplate> also?

if (!IsPostBack)

String selectionId = Request.Params["recordNo"];
if (selectionId != null)
DataList1.SelectedIndex = Int32.Parse(selectionId) - 1;

<asp:datalist id="DataList1" runat="server"
<asp:Label id="MyLabel" runat="server" CssClass="MenuSelected"
Text="Test" />
<asp:HyperLink id="Hyperlink1" runat="server"
CssClass="MenuUnselected" Text='<%# DataBinder.Eval(Container.DataItem,
"Name")%>' NavigateUrl='<%# "articles.aspx?recordNo=" +
DataBinder.Eval(Container.DataItem, "ID")%>' >

Thank you,


Reply With Quote

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
SelectedItemTemplate does not show in datalist Raymond Du ASP .Net 1 12-05-2004 01:17 PM
<selectedItemTemplate> Steve Klett ASP .Net Datagrid Control 2 11-19-2003 12:18 AM
Datalist selects Item after first click, but does apply the SelectedItemTemplate after the second click only Dirk Meusel ASP .Net 1 08-19-2003 09:56 AM
datagrid within SelectedItemTemplate of another grid Randy Vande Hei ASP .Net 0 08-04-2003 08:49 PM
datagrid within SelectedItemTemplate of another grid Randy Vande Hei ASP .Net Datagrid Control 0 08-04-2003 08:49 PM