We help IT Professionals succeed at work.

mouseover repeater not working.

omegalove
omegalove used Ask the Experts™
on
       protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {

            // make sure this is an item in the data list (not header etc.)
            if ((e.Item.ItemType == ListItemType.Item) ||
                (e.Item.ItemType == ListItemType.AlternatingItem)) // Get Primary Image
            {
                //Panel pnl = (Panel)e.Item.FindControl("imageBack");
                //if (pnl != null)
                //{
                Panel Container = e.Item.FindControl("Container") as Panel;
                Container.Attributes["onmouseover"] = "this.style.backgroundColor='Silver'";
                Container.Attributes["onmouseout"] = "this.style.backgroundColor='LightBlue'";
}
}


<asp:Repeater ID="rptList" runat="server" OnItemDataBound="rptList_ItemDataBound">
            <HeaderTemplate>
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Panel ID="Container" runat="server">
                    <table width="100%" class="profile-box">
                        <tr>
                            <td>
                                <div class="profile-item">
                                    <div class="pic">
                                        <asp:HyperLink ID="HLMainPicID" runat="server" NavigateUrl='<%#"~/Secure/ViewProfile.aspx?UserName="+Eval("UserName") %>'>
                                            <asp:Image ID="MainPicID" Style="vertical-align: middle" runat="server" />
                                        </asp:HyperLink>
                                    </div>
                                    <div class="info">
                                        <span class="srusername">
                                            <%#DataBinder.Eval(Container,"DataItem.UserName")%></span>
                                        <br />
                                        <%#DataBinder.Eval(Container,"DataItem.Age")%>&nbsp;Years Old&nbsp;<%#DataBinder.Eval(Container,"DataItem.GenderName")%>
                                        -&nbsp;<%#DataBinder.Eval(Container,"DataItem.ZodiacName")%>&nbsp;
                                        <asp:Image ID="imgZodiacSign" ImageUrl='<%# GetUrl(Eval("ZodiacName")) %>' Style="vertical-align: middle"
                                            runat="server" />
                                        <br />
                                        <%#DataBinder.Eval(Container,"DataItem.HeightName")%>&nbsp;-&nbsp;<%#DataBinder.Eval(Container,"DataItem.BodyTypeName")%>
                                        <br />
                                        <%#DataBinder.Eval(Container,"DataItem.HairColorName")%>&nbsp;Hair,&nbsp;<%#DataBinder.Eval(Container,"DataItem.EyeColorName")%>&nbsp;Eyes<br />
                                        <%#DataBinder.Eval(Container,"DataItem.EthnicityName")%>
                                        <br />
                                        <%#DataBinder.Eval(Container,"DataItem.GenderName")%>&nbsp;Seeking&nbsp;
                                        <%#DataBinder.Eval(Container,"DataItem.SeekingName")%>
                                        <br />
                                        <div class="loc">
                                            <%#DataBinder.Eval(Container,"DataItem.CityName")%>,&nbsp;<%#DataBinder.Eval(Container,"DataItem.RegionName")%>,
                                            &nbsp;<%#DataBinder.Eval(Container,"DataItem.Country")%>
                                        </div>
                                    </div>
                                    <div class="detail">
                                        <span>
                                            <%#DataBinder.Eval(Container,"DataItem.HeadLine")%></span>I really dont know
                                        what to say, so here it goes. i'm a loner, im open minded,and im a smartass, plus
                                        sometimes im 2 honest and blunt.
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <asp:HiddenField ID="hiddenImgID" runat="server" Value='<%#DataBinder.Eval(Container,"DataItem.ProfileID") %>' />
                    </table>
                </asp:Panel>
            </ItemTemplate>
            <FooterTemplate>
            </FooterTemplate>
            <SeparatorTemplate>
                <br />
            </SeparatorTemplate>
        </asp:Repeater>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
try this:

Container.Attributes.Add("onmouseover", "javascript:this.style.backgroundColor='Silver';");
Container.Attributes.Add("onmouseout", "this.style.backgroundColor='LightBlue'");
try this:

Container.Attributes.Add("onmouseover", "javascript:this.style.backgroundColor='Silver';");
Container.Attributes.Add("onmouseout", "javascript:this.style.backgroundColor='LightBlue'");

Author

Commented:
still nothing.
Many things may happened for your html.
It'll be usefull to post your rendered html code here.
But in your case i think you can put hardcode script in your code
for example put this code in your Table element
onmouseover="javascript:alert();this.style.backgroundColor='red';"

Author

Commented:
i got it working.

Author

Commented:
k