Question: using gcc 4.5.1 in a 64bit x86 machine,I first create a.o as following:
g++ -fPIC -c a.cc -o a.o

then try to create liba.so as following:
g++ -static-libstdc++ -shared -W1,-soname,liba.so -o liba.so.1.0.0 a.o

but failed, with the following information:
relocation R\_X86\_64\_32S against `vtable for \_\_gnu\_cxx::stdio\_filebuf >' can not be used when making a shared object; recompile with -fPIC

I try to recompile libstdc++ library,with -fPIC added,but it failed anyway

Answer: 
This code in the RowDataBound event handler for the gridview worked for me:

```
protected void dgv_usersRowDatabound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowIndex == intEditIndex)
    {
        DropDownList drpCategory = e.Row.FindControl("drpCategory") as DropDownList;
        drpCategory.Focus();
    }
 }

```

The Gridview contains a dropdownlist in each row as an EditItemTemplate.
This worked for me, and required no ASP.NET AJAX, UpdatePanel or cookie, and a lot less JavaScript than other solutions I've seen.

```
<input type="hidden" runat="server" id="hdnScroll" value="0" />
<div style="height:600px; overflow-x:hidden; overflow-y:scroll">
  <asp:GridView runat="server" ID="myGridView" OnRowDataBound="myGridView_RowDataBound" OnSelectedIndexChanged="myGridView_SelectedIndexChanged">
...
</asp:GridView>
</div>

```

Then

```
protected void myGridView_SelectedIndexChanged(object sender, EventArgs e) {
    //if(gr != null) gr.SelectedRow.Cells[0].Focus(); // Only works on an editable cell

    hdnScroll.Value = (myGridView.SelectedIndex * (int)myGridView.RowStyle.Height.Value).ToString();
}

```

Finally back in the .aspx, to run upon postback

```
<script type="text/javascript">
$(function() {
  document.getElementById('<%=myGridView.ClientID%>').scrollTop = $('#hdnScroll').val();
});

```