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!

Conversion Help 1

Status
Not open for further replies.

battleangela

Technical User
May 25, 2007
11
US
Hi

I have a mouseover event for a data grind written in C#, the problem is I am now have to use VB in an asp.net page. Can someone help me with the syntax of it ? I am not that familiar with vb.net, so it been a hard time.

protected void MyGridView_RowCreated(object sender, GridViewRowEventArgs e)

{

string onmouseoverStyle = "this.style.backgroundColor='blue'";

string onmouseoutStyle = "this.style.backgroundColor='#@BackColor'";

string rowBackColor = String.Empty;

if (e.Row.RowType == DataControlRowType.DataRow)

{

if (e.Row.RowState == DataControlRowState.Alternate)

rowBackColor = MyGridView.AlternatingRowStyle.BackColor.Name.Remove(0, 2);

else rowBackColor = MyGridView.RowStyle.BackColor.Name.Remove(0, 2);

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

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

}

}
 
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

Check out this online utility:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top