473,394 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Smartnavigation with grid on second page

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?
Nov 18 '05 #1
2 1013
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.)

Nov 18 '05 #2
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 youplease 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 AsSystem.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 norights.)

.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: SLE | last post by:
A web user control exposes a RadioButtonList (with AutoPostBack = true) called "Question". This control also has an embedded RequiredFieldValidator control. 1. Main ASPX page is populated with...
2
by: amiringo | last post by:
I have two problems after set this page directive... First, when I run the web application in my side(installed VS.NET) the page include that directive, it will redirect to the following address....
3
by: Carl Mercier | last post by:
Hi, I have a long form that post back to itself at different places. At the very end, I have a button called "Next" that post back to itself again but some panels are hidden and some others are...
3
by: Nestus | last post by:
Hi, im developing a solution in ASP.Net, i have a page that i need to use the smartnavigation in true, the problem occurs when i put in the directive @Page SmartNavigation = true my page trhows a...
3
by: Steve Peterson | last post by:
Hi I have a rather lengthy webform I'm working on in which I need the user to be able to scroll to the same place between postbacks. I tried turning on SmartNavigation and it seemed to work...
2
by: Wysiwyg | last post by:
Has anyone found a reasonable way to emulate smartnavigation functionality for any browser? I'd really like to avoid creating history entries when posting back to the same page. SmartNavigation...
7
by: morrisdn13 | last post by:
I have encountered a very strange problem that makes it look like the page is not recreated in entirety after a postback when I turn on smartnavigation. If I click on a server control, the page...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
5
by: Finn Stampe Mikkelsen | last post by:
Hi How can i set a focus to a textbox in my codebehind page?? I have this WebForm, that takes information from a user and 2 buttons on the form. One that takes action on the entered...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.