Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gridview mouseover problems

Status
Not open for further replies.

battleangela

Technical User
May 25, 2007
11
US
Hi

I have a gridview and sqlconnection that work properly. I am using the windows web develop 2005 explorer edition, and made all the functions work. I tried using the this code to have a mouseover event when someone entere into the gridview. The problem is that the code does not even load. I used breakpoint to see if their was a problem but it dot even stop.

Here is the code:

Protected Sub MyGridView_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)


Dim onmouseoverStyle As String = "this.style.backgroundColor='blue'"

Dim onmouseoutStyle As String = "this.style.backgroundColor='#@BackColor'"

Dim rowBackColor As String = [String].Empty

If e.Row.RowType = DataControlRowType.DataRow Then


If e.Row.RowState = DataControlRowState.Alternate Then
rowBackColor = MyGridView.AlternatingRowStyle.BackColor.Name.Remove(0, 2)
Else
rowBackColor = MyGridView.RowStyle.BackColor.Name.Remove(0, 2)


End If

e.Row.Attributes.Add("onmouseover", onmouseoverStyle)


e.Row.Attributes.Add("onmouseout", onmouseoutStyle.Replace("@BackColor", rowBackColor))
End If

End Sub

Here is the html part:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<html xmlns=" >
<HEAD>
<TITLE>Popup Example</TITLE>

<SCRIPT LANGUAGE="JScript">
var oPopup = window.createPopup();
function ButtonClick()
{
var oPopBody = oPopup.document.body;
oPopBody.style.backgroundColor = "lightyellow";
oPopBody.style.border = "solid black 1px";
oPopBody.innerHTML = "Click outside <B>popup</B> to close.";
oPopup.show(100, 100, 180, 25, document.body);
}
</SCRIPT>
</HEAD>

<BODY>
<form runat="server">
<BUTTON onclick="ButtonClick()">Click Me!</BUTTON>
<button id="alpha" onmouseover="ButtonClick()" style="left: 124px; position: absolute; top: 11px">Move OVer</button>
&nbsp;
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:Con+PorjectConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:Con+PorjectConnectionString1.ProviderName %>"
SelectCommand="SELECT [text_course], [text_course_id] FROM [Text]"></asp:SqlDataSource>
&nbsp; &nbsp;
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource3" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" ForeColor="Black" style="left: 59px; position: absolute; top: 96px">
<Columns>
<asp:BoundField DataField="text_course" HeaderText="Course Name" SortExpression="text_course" />
<asp:BoundField DataField="text_course_id" HeaderText="Course ID" SortExpression="text_course_id" />
<asp:HyperLinkField DataTextField="text_course" HeaderText="Test" />
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<RowStyle BackColor="White" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
</asp:GridView>
</form>
</BODY>
</HTML>
 
I see that you don't even have the courtesy to thank KDavie who converted the C# code for you thread796-1376528, and yet you expect more assistance.

Nobody here is obliged to help you (and neither do they get paid to) - a minimum of a thank-you, when someone takes the trouble to do so is surely not too much to expect.

[vampire][bat]
 
you are right, I should have been more curtiouse to Kdavie.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top