Help with GridView jumping.

T

teejayem

I am new to asp.net.

I have a grid view that is bound to a dataview.
I have used a small javascript to select the rows in the gridview see
below:-

<script language="javascript" type="text/javascript">

var oldgridSelectedColor;

function setMouseOverColor(element) {

oldgridSelectedColor = element.style.backgroundColor;
element.style.backgroundColor='silver';
element.style.cursor='hand';
element.style.textDecoration='underline';
}

function setMouseOutColor(element) {

element.style.backgroundColor=oldgridSelectedColor;
element.style.textDecoration='none';
}

</script>

Protected Sub DefaultGridView_RowDataBound(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles
DefaultGridView.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes("onmouseover") =
"javascript:setMouseOverColor(this);"
e.Row.Attributes("onmouseout") =
"javascript:setMouseOutColor(this);"
e.Row.Attributes("onclick") =
ClientScript.GetPostBackClientHyperlink(DefaultGridView, "Select$" &
CStr(e.Row.RowIndex))
End If
End Sub

This works fine.
The problem I am having is that when an item is selected the grid view
changes size and the header column text jumps around.
I can set a fixed width to the gridview but this doesn't stop the
columns changing shape/size.
Is there an easy way to resolve this?
 

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,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top