Question

I have an AspxGridView in my project with AllowFocusedRow="True". Every time I load the page (with the table) the first row is focused. When I assign -1 to gvMain.FocusedRowIndex on server side (before the page loading) it doesn't help. But when I change the focused row index on client side:

                    Init="function() {
                    gvMain.SetFocusedRowIndex(-1);

then it loads the table with first row selected which then disappears. So I guess it is better to define it earlier. But how?

Was it helpful?

Solution

The solution was the PreRender event:

protected void ASPxGridView1_PreRender(object sender, EventArgs e) {
        if(!IsPostBack)
            ASPxGridView1.FocusedRowIndex = -1;
    }

OTHER TIPS

Use the ASPxGridView's DataBound event as shown below to hide the FocusedRow:

protected void ASPxGridView1_DataBound(object sender, EventArgs e) {
        if(!IsPostBack)
            ASPxGridView1.FocusedRowIndex = -1;
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top