GetRichSlow1
GetRichSlow1

Reputation: 5

undefined coming up in firefox

my previous quesion was answered, but now the same thing that works in IE doesn't work like it should in Firefox.

my C# looks like this:

protected void OnRowCreated(object sender, GridViewRowEventArgs e)  
{  
    if (e.Row.RowType == DataControlRowType.DataRow)  
    {  
        e.Row.Attributes.Add("ondblclick", "sample(this)");  
        }  
}

my javascript looks like this:

function sample(rowIn) {  
    alert("D");  
    var gViewRowColumn = rowIn.cells[0];  
    var displayCell = gViewRowColumn.innerText;  
    alert(displayCell);  
}

The problem is that this works fine in IE but when I try it in Firefox, after alert D displays "D" the next alert just displays "undefined". I googled around and found some things relating to events but I could not understand nor correctly implement them. Any help would be appreciated.

Upvotes: 0

Views: 173

Answers (1)

Quintin Robinson
Quintin Robinson

Reputation: 82355

There is no such property as innerText in firefox, use textContent

Something like this should work for your needs.

var displayCell = gViewRowColumn.innerText || gViewRowColumn.textContent;

Upvotes: 3

Related Questions