WebControl

G

Guest

I am developing a WebControl derived from a GridView

As to make to codify the RowDataBound event of the GridView in the WebControl?
 
C

caffienerush

Are you are trying to handle the RowDataDound event?

If yes then the way I prefer is:

'gridview declared withevents.
Private WithEvents gv As GridView

Private Sub gv_RowDataBound(ByVal s As Object, ByVal e As
GridViewRowEventArgs) Handles gv.RowDataBound
'Handle gv's row data event here.
End Sub

Regards.
 
G

Guest

The code below did not function.

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls


Public Class WebGridView
Inherits System.Web.UI.WebControls.GridView

Public WithEvents gv As GridView

Public Sub gv_RowDataBound(ByVal s As Object, ByVal e As
GridViewRowEventArgs) Handles gv.RowDataBound
e.Row.Attributes.Add("onclick", "alert('leandro')")
End Sub

End Class
 
G

Guest

I decided with code below


public class WebGridView : System.Web.UI.WebControls.GridView
{
protected override void onRowDataBound(GridViewRowEventArgs e)
{
base.OnRowDataBound(e);
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseout",
"this.style.backgroundColor='white'");
e.Row.Attributes.Add("onmouseover",
"this.style.backgroundColor='#D7D8B8'");
e.Row.Attributes.Add("style", "cursor:hand");
}
}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top