Smartnavigation with grid on second page

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

I've got a long page (user requirement) with a datagrid on
the second scrolled page. I've got smartnavigation on and
it works fine for everything else on the page, but if I
click a sort header or an item edit on the datagrid,
postback puts me back to the top of the page.

Any way I can get smartnavigation to work for a postback
triggered by from a datagrid?
 
Hi Rick,

I tested a simple sample and haven't found the same problem. Could you
please take a try with my code to see if there is any difference between us?

<asp:datagrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 64px; POSITION:
absolute; TOP: 40px" runat="server" Height="224px" Width="408px"
DataSource="<%# DataSet11 %>" DataMember="Customers"
AutoGenerateColumns="False" OnEditCommand="DataGrid1_Edit">
<Columns>
<asp:EditCommandColumn ButtonType="PushButton" EditText="Edit"
CancelText="Cancel" UpdateText="Update"></asp:EditCommandColumn>
<asp:BoundColumn DataField="Address"
HeaderText="Name"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="ID">
<ItemTemplate>
<%#Container.DataItem("CustomerID")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox>
<%# Container.DataItem("CustomerID") %>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>





Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Me.SmartNavigation = True

If Not IsPostBack Then


SqlDataAdapter1.Fill(DataSet11)


DataGrid1.DataBind()


End If
End Sub


Sub DataGrid1_Edit(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)

DataGrid1.EditItemIndex = e.Item.ItemIndex
SqlDataAdapter1.Fill(DataSet11)
DataGrid1.DataBind()

End Sub


Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
I should have added that the Grid is in a control. The
page has several other controls before it.

If I only used the one control (with the grid) it worked
fine. It's only when there are other controls before it
that the smartnav didn't work.

Anyway, I played around with control positioning on the
main page and something I did made it work. In fact, I
can't recreate the problem.

Thanks for your help.
-----Original Message-----
Hi Rick,

I tested a simple sample and haven't found the same problem. Could you
please take a try with my code to see if there is any difference between us?

<asp:datagrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 64px; POSITION:
absolute; TOP: 40px" runat="server" Height="224px" Width="408px"
DataSource="<%# DataSet11 %>" DataMember="Customers"
AutoGenerateColumns="False" OnEditCommand="DataGrid1_Edit">
<Columns>
<asp:EditCommandColumn ButtonType="PushButton"
EditText="Edit"
CancelText="Cancel"
<asp:BoundColumn DataField="Address"
 
Back
Top