473,324 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

OnItemDataBound issue...



The following code causes two letters to be highlighted at once,
so for example, if you click on Division 2 letter 'A', the letter 'A'
in Division 1 is also highlighted. I want only one letter highlighted,
and I wand the proper division number to be highlighted alone, as well.

It seems that because the letters bound to the letterList datalist in a
nested
datalist, I cannot call the onitemdatabound event on one hyperlink only,
because
they have the same name (HyperLink1)? How can I work around this issue?

Thanks in advance.

The user interface:


Division 1 A B C D E F G H I J K L M N O P Q R S T
U V W X Y Z All
Division 2 A B C D E F G H I J K L M N O P Q R S T
U V W X Y Z All


The HTML/ASP.NET code:
<asp:DataList Width="100%" ID="divList"
DataSource='<%#getDivisions()%>' OnItemCommand="getEmployeesByDivision"
RepeatDirection="Horizontal"
Runat="server" AutoGenerateColumns="False">
<ItemTemplate>
<tr>
<td width="50%" align="left">Division</td>
<td>
<asp:LinkButton id="divNumber" Text='<%#
Convert.ToInt16(DataBinder.Eval(Container.DataItem , "DivisionNumber"))
%>' Runat="server" CommandName="GetEmployees" >
</asp:LinkButton>
</td>
<td>
<asp:DataList ID="letterList" OnItemDataBound="boldLetter"
DataSource='<%#getLetters(Convert.ToInt16(DataBind er.Eval(Container.DataItem,

"DivisionNumber")))%>' Runat="server" RepeatDirection="Horizontal">
<ItemTemplate>
<asp:HyperLink Runat=server
Text='<%#DataBinder.Eval(Container.DataItem, "Letter")%>'
NavigateUrl='<%# "/Solver/Pages/Page5.aspx?id=13&division=" +
DataBinder.Eval(Container.DataItem, "DivNumber") + "&letter=" +
DataBinder.Eval(Container.DataItem, "Letter") %>' ID="Hyperlink1">
</asp:HyperLink>
</ItemTemplate>
</asp:DataList>
</td>
</tr>
</ItemTemplate>
</asp:DataList>

The C# codebehind to highlight the letter in the user interface:
public void boldLetter(Object sender, DataListItemEventArgs e)
{
string thisAlpha= ((HyperLink)e.Item.FindControl("HyperLink1")).Text ;
if (thisAlpha==alpha){
((HyperLink)e.Item.FindControl("HyperLink1")).Back Color = Color.Gray;}
}

Nov 18 '05 #1
0 791

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ItNerd | last post by:
The following code causes two letters to be highlighted at once, so for example, if you click on Division 2 letter 'A', the letter 'A' in Division 1 is also highlighted. I want only one letter...
0
by: ItNerd | last post by:
The following code causes two letters to be highlighted at once, so for example, if you click on Division 2 letter 'A', the letter 'A' in Division 1 is also highlighted. I want only one letter...
0
by: ItNerd | last post by:
The following code causes two letters to be highlighted at once, so for example, if you click on Division 2 letter 'A', the letter 'A' in Division 1 is also highlighted. I want only one letter...
0
by: ItNerd | last post by:
The following code causes two letters to be highlighted at once, so for example, if you click on Division 2 letter 'A', the letter 'A' in Division 1 is also highlighted. I want only one letter...
0
by: ItNerd | last post by:
The following code causes two letters to be highlighted at once, so for example, if you click on Division 2 letter 'A', the letter 'A' in Division 1 is also highlighted. I want only one letter...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.