Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

SelectedItemTemplate is ignored

 
 
Lubomir
Guest
Posts: n/a
 
      02-26-2005
Hi,

I have a datalist with the definition for ItemTeplate and
SelectedItemTemplate.
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)
{
BindData();
}

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

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


Thank you,

Lubomir

 
Reply With Quote
 
 
 
Reply

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



Advertisments