Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DataList and css class

Reply
Thread Tools

DataList and css class

 
 
sameer
Guest
Posts: n/a
 
      06-29-2005
Hi,

i am having a pretty strange problem here, My left menu is an ascx control
which has 3 datalist in it each containing subcategories. ADO.net Datatables
are bound to these datagrids when the page loads and in the html page of ascx
code of the menu control i have the follwing piece of code but repeated 2
more times for other categories( of course name of controls are all different)

<asp:datalist id="MyList" EnableViewState="false"
SelectedItemStyle-BackColor="dimgray" width="145" cellspacing="0"
cellpadding="0" runat="server">
<SelectedItemStyle BackColor="Transparent"></SelectedItemStyle>
<HeaderTemplate>
Test
</HeaderTemplate>
<SelectedItemTemplate>
<asp:HyperLink id=HyperLink2 runat="server" NavigateUrl='<%
"productslist.aspx?CategoryID=" & DataBinder.Eval(Container.DataItem,
"CategoryID") & "&selection=" & Container.ItemIndex %>'
cssclass="MenuSelected" Text='<%# DataBinder.Eval(Container.DataItem,
"CategoryName") %>'>
</asp:HyperLink>
</SelectedItemTemplate>
<ItemStyle Height="20px"></ItemStyle>
<ItemTemplate>
<asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#
"productslist.aspx?CategoryID=" & DataBinder.Eval(Container.DataItem,
"CategoryID") & "&selection=" & Container.ItemIndex %>'
cssclass="MenuUnselected" Text='<%# DataBinder.Eval(Container.DataItem,
"CategoryName") %>'>
</asp:HyperLink>
</ItemTemplate>
<HeaderStyle CssClass="MenuSelected2" BackColor="DimGray"></HeaderStyle>
</asp:datalist>
When i click on a subcategory item which is in the 3rd list, i see the rigth
contents being pulled frm the database but i also expect the subcategory that
i have selected to look like what the css class it is set to which is
MenuSelected but what is happening is that the subcategory with the same
sequnce no( lets say i selected the 3rd item in the bottom most gird, so the
3 rd item from the top most grid(always topmost)) is being the set clss class.

when i took out the piece of code (which is & "&selection=" &
Container.ItemIndex) from the <SelectedItemTemplate> and <ItemTemplate> 's
Hyperlinks this behavior does not happen any more but i as well loose the
feature of the subcategory being highligted (since it has the css class
"MenuSelected" which sets a differnte size and font of the category) when the
user clicks on it.

can any body suggest why this is happennig and how can i possibly fix this
issue so that when i click a subacategory of a certain list, only it shold be
set the menuselected clss class and not the one from the top most list.

Please help. if i am not clear , shoot me a question.

Sameer
 
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
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
Click event in a datalist to post back datalist properties Steve Lloyd ASP .Net 1 05-26-2004 04:07 AM
DataList in DataList acko bogicevic ASP .Net 2 11-11-2003 08:31 AM
Datalist in Datalist How? Gönen EREN ASP .Net 0 08-22-2003 02:41 PM



Advertisments