In ASP.NET 1.1, I have SmartNavigation turned on so that the user's focus
will remain on the line in the datagrid they choose to edit.
When the user chooses to add a new line in the datagrid, rather than only
show that line, I'm displaying all items in the datagrid, with the new line
at the bottom.
With grdResults
' Set editing on last row
.EditItemIndex = .Items.Count
.DataSource = ds
.DataBind()
End With
This is fine if the number of items in the grid doesn't go beyond a page.
After that, the new line is not the focus, and the user needs to scroll down
the page to access the new line. How can I set the focus to that new line?
Here is my code in the Page_Load event:
If Not Page.IsPostBack Then
Try
Me.LoadGrid()
Catch ex As Exception
ShowMessageBox( Me, ex.Message)
End Try
End If 3 2326
If your datagrid has more than one page and you want the last page to be
displayed, calculate the last page number by dividing
grdResults.Item s.Count/grdResults.Page Size then set the
grdResults.Curr entPageIndex to that number before doing the DataBind and
after you set the EditItemIndex to the Items.Count.
--
HTH,
Phillip Williams http://www.societopia.net http://www.webswapp.com
"Richard" wrote: In ASP.NET 1.1, I have SmartNavigation turned on so that the user's focus will remain on the line in the datagrid they choose to edit.
When the user chooses to add a new line in the datagrid, rather than only show that line, I'm displaying all items in the datagrid, with the new line at the bottom. With grdResults ' Set editing on last row .EditItemIndex = .Items.Count .DataSource = ds .DataBind() End With
This is fine if the number of items in the grid doesn't go beyond a page. After that, the new line is not the focus, and the user needs to scroll down the page to access the new line. How can I set the focus to that new line? Here is my code in the Page_Load event: If Not Page.IsPostBack Then Try Me.LoadGrid()
Catch ex As Exception ShowMessageBox( Me, ex.Message) End Try End If
Thanks Phillip, but I'm not using datagrid paging. I just need to know how to
set focus to the blank datagrid row at the bottom of the web form. If the
grid has only a few items, this isn't an issue because the user can see it
without scrolling down the web page. But when the grid has say 25 items, and
the user wants to create a new item, the last row is out of view until the
user scrolls vertically.
"Phillip Williams" wrote: If your datagrid has more than one page and you want the last page to be displayed, calculate the last page number by dividing grdResults.Item s.Count/grdResults.Page Size then set the grdResults.Curr entPageIndex to that number before doing the DataBind and after you set the EditItemIndex to the Items.Count. -- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"Richard" wrote:
In ASP.NET 1.1, I have SmartNavigation turned on so that the user's focus will remain on the line in the datagrid they choose to edit.
When the user chooses to add a new line in the datagrid, rather than only show that line, I'm displaying all items in the datagrid, with the new line at the bottom. With grdResults ' Set editing on last row .EditItemIndex = .Items.Count .DataSource = ds .DataBind() End With
This is fine if the number of items in the grid doesn't go beyond a page. After that, the new line is not the focus, and the user needs to scroll down the page to access the new line. How can I set the focus to that new line? Here is my code in the Page_Load event: If Not Page.IsPostBack Then Try Me.LoadGrid()
Catch ex As Exception ShowMessageBox( Me, ex.Message) End Try End If
Hi Richard,
Assuming that the datagrid is the last element on the page, you might add
the following line after the DataBind step:
Page.RegisterSt artupScript("Sc rollTop", "<script
language='JavaS cript'>document .body.scrollTop =100000;</script>")
Where 100000 is an arbitrary large number that would cause the browser to
scroll to the end of the page.
--
HTH,
Phillip Williams http://www.societopia.net http://www.webswapp.com
"Richard" wrote: Thanks Phillip, but I'm not using datagrid paging. I just need to know how to set focus to the blank datagrid row at the bottom of the web form. If the grid has only a few items, this isn't an issue because the user can see it without scrolling down the web page. But when the grid has say 25 items, and the user wants to create a new item, the last row is out of view until the user scrolls vertically.
"Phillip Williams" wrote:
If your datagrid has more than one page and you want the last page to be displayed, calculate the last page number by dividing grdResults.Item s.Count/grdResults.Page Size then set the grdResults.Curr entPageIndex to that number before doing the DataBind and after you set the EditItemIndex to the Items.Count. -- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"Richard" wrote:
In ASP.NET 1.1, I have SmartNavigation turned on so that the user's focus will remain on the line in the datagrid they choose to edit.
When the user chooses to add a new line in the datagrid, rather than only show that line, I'm displaying all items in the datagrid, with the new line at the bottom. With grdResults ' Set editing on last row .EditItemIndex = .Items.Count .DataSource = ds .DataBind() End With
This is fine if the number of items in the grid doesn't go beyond a page. After that, the new line is not the focus, and the user needs to scroll down the page to access the new line. How can I set the focus to that new line? Here is my code in the Page_Load event: If Not Page.IsPostBack Then Try Me.LoadGrid()
Catch ex As Exception ShowMessageBox( Me, ex.Message) End Try End If This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stephen |
last post by:
I've got a datagrid with a remove button and I would like to add some code in
the code behind page so as whenthe button is clicked the corresponding row in
the datagrid is removed. The Datagrid is populated by the items in an
arraylist shown in the code below. When the button is clicked I would also
like the code to remove the items from the Arraylist. I've very little
experience working with datagrids and arraylists so im finding this...
|
by: Chris Plowman |
last post by:
Hi all,
I was wondering if anyone can help me with a really annoying problem I have
been having. I made a derived datagrid class that will select the row when
a user clicks anywhere on a cell (multi-select without modifier keys). I
got that working fine, but I also wanted to keep rows selected after a sort,
which I do by storing the row's id in an arraylist. The idea was to do the
sort and then go back and re-select the rows with that...
|
by: VMI |
last post by:
Hi,
I have a Windows datagrid that's attached to a filled datatable. The grid
also has a tablestyle. Since the data from the grid comes from a
datatatable, how can I retrieve the data from a specific table row once a
user clicks on a grid row? I already have the code that lets me know what
grid row the user clicked on, but, for example, if I want to retrieve the
value of the 5th column in the grid, I'm currently using myGrid.ToString()....
|
by: Strahimir Antoljak |
last post by:
I bound a DataGrid to a table (I tried with a DataView too).
I removed the row from the table, and then inserted a new
row at the same row index. the table gets the row to the
right position, but the bound DataGrid does not pick up
and appends the inserted row at the bottom of the grid,
not the right position?!?
Any ideas how to make the DataGrid pick up the changes
done in the table - to show the inserted row at the right
position?
|
by: John Hernry |
last post by:
I have been watching the dotnet newsgroups for a couple of weeks now and
scouring the net looking for a solution to my datagrid find functionality.
With no luck. I am hoping that you can help me.
I am an old VB6 coder used to using Sheridan controls, and I am just
starting to learn the .net world.
I am upgrading my music catalogue database, where the data is stored in an
Access mdb file.
| |
by: Jeff User |
last post by:
Hi
I tryed to solve this problem over in the framework.asp group, but
still am having trouble. Hope someone here can help.
using .net 1.1, VS 2003 and C#
I have an asp.DataGrid control with a Delete button on the end of each
row. I am unable to gain access to the event when the button is
clicked.
I don't fully understand how the click gets connected to the C# code,
|
by: Antonio |
last post by:
Hello, everyone.
Is there a way to not display a certain value in a datagrid cell?
I have a datagrid for subscriptions and ebooks and if there isn't an e-book
listed, the value from the database (SQL) is "Null/No Set Dummy Row".
Is there a way I can suppress that data in the datagrid?
Thanks,
|
by: DaveS |
last post by:
I am trying to capture the mouse click position in a datagrid but I get the
following compilation error:
Compiler Error Message: BC30002: Type 'System.Windows.Forms.MouseEventArgs'
is not defined.
Source Error:
Line 84: Private myCheckBoxCol As Integer = 0 'my checkbox column
Line 85:
|
by: slinky |
last post by:
I found the following code to transfer datagrid data to an Excel file.
Is this written in C#?... I'm a vb.netter. I'm just not sure where to
place the code to experiment on it. Should I place it in the event
handler for a form button. Is there other ways to accomplish this? I
looked at some on the web and usergroups, but was confused as to the
functioning. BTW my datagrid is enclosed in a <div></divfor ease of
scrolling if that would...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |