extending the gridview control

R

Robert Smith

Hello I have some code to extend the gridview control as shown that hides the
Select button and underlines the text as you scroll on it.

I have also overridden the SelectIndexChanged event so that it highlights
the row on selection.
I use this control on a particular form and I trigger the event
OnSelectIndexChanged = "gridview_selectIndexChanged" where I wish it to
carry out the normal SelectIndexchanged event in my extended control and also
some extra stuff as shown below. It just ignores this and carries out the
default behaviour, how do I get it so that it carries out the default as well
as any extra stuff I put in .

//form with my extended gridview control in it
protected void gridview_SelectIndexChanged(object sender, EventArgs e)
{
//Some extra functionality goes here
}



// My Extended Grid view control

public partial class SpecialGridView : System.Web.UI.WebControls.GridView
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected override void OnSelectedIndexChanged(EventArgs e)
{
for (int i = 0; i <= this.Rows.Count - 1; i++)
{
this.Rows.BackColor = System.Drawing.Color.White;
}
this.SelectedRow.BackColor = System.Drawing.Color.Orange;
}


protected virtual void OnRowDataBound(GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] =
"this.style.cursor='hand';this.style.textDecoration='underline';";
e.Row.Attributes["onmouseout"] =
"this.style.textDecoration='none';";
e.Row.Attributes["onclick"] =
Page.ClientScript.GetPostBackClientHyperlink(this, "Select$" +
e.Row.RowIndex);

}

}
}
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top