Solved

Jump to Tag in VB.NET / ASP.NET

Posted on 2006-07-19
8
1,001 Views
Last Modified: 2008-01-09
Hi I am very new to web development - so I apologise in advance if this question seems disjointed.

I have two gridviews on a web page and when a record is selected on the first gridview. I want to jump to the area of the page that is displaying the second gridview.

Looking through EE, it seems like I need to use tags, but I have no idea how to, either in setting up a tag or how to jump there (this may be the disjointed bit :-)

I presume that the VB.NET code to jump there will be in the gridview1.selectedindexchanged event.

Many thanks for any help in getting me going again...
...Steve
0
Comment
Question by:swtiley
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 17137588
do you want to somthing like when you click on the record of first grid
you want to show the reords in 2nd grid depending on the first grid record......

is it like this??
0
 
LVL 1

Author Comment

by:swtiley
ID: 17137605
yes - that is it - I have parentchild functionality working correctly - however the page is over the length of the screen, and therefore I just want to show the area of the page that contains the 2nd gridview.

Cheers
0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 17137628
Hi,

I appreciate that the link here http://authors.aspalliance.com/aldotnet/examples/dgautoscroll.aspx is based on DataGrids rather than GridViews, but the principle of what you want to achieve is there. Rather than hit the ItemDataBound for the first GridView as is similar in the example, edit the values in the second GridView. I hoipe this helps in some way. I'm battling with GridViews at the moment so I know how frustrating they can be.

Regards,

Lee
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
ID: 17137653
I have one trick coding for you......try it........

put a lable  like
<asp:Label ID="L1" runat="server"></asp:Label>
just below the 2nd gridview

& when you are setting the values to 2nd view or you want to show the area of the page that contains the 2nd gridview

use
L1.focus()


hope it helps for u :)
thanx :)
0
 
LVL 18

Expert Comment

by:tusharashah
ID: 17138193
Like I said in the other post, try with SetFocus method, here's VB.net code for that:

Public Sub setFocus(ctrl As System.Web.UI.Control)
        Dim strS As String
        strS = "<SCRIPT language='javascript'>"
        strS = strS + "function SetFocus(){ "                 
        strs = strs + "document.getElementById"
        strs = strs + "('"
        strs = strs + ctrl.ID
        strs = strs + "').focus();"
        strS = strS + " } "                                             
        strS = strS + "window.setTimeout(SetFocus, 100);"    
        strs = strs + "</"
        strs = strs + "SCRIPT>"

        Page.RegisterStartupScript("focus", strS)
    End Sub
0
 
LVL 1

Expert Comment

by:chuang4630
ID: 17138683
SetFocus() should work, as suggested by tusharashah.

BTW, based on your description of the page, I am wondering whether you have ever thought about the page layout optimization? A long long page may not be at the best interest to the user.
0
 
LVL 1

Author Comment

by:swtiley
ID: 17138960
Hi tusharashah,

thank you for the code, I have inserted the setfocus function at the bottom of the webusercontrol ASP code, and tried to set the focus to my gridview2 using the following VB line in the gridview1.selectedindexchanged code

setFocus(Gridview2)

however I get an error stating

Name setFocus is not declared.

Have I missed something out. FYI I do store my vb code in a separate file of webusercontrol.aspx.vb

Thanks
...Steve

P.s. and thanks for the comment chuang4630

0
 
LVL 18

Expert Comment

by:tusharashah
ID: 17139037
The issue seems to be related to scope now. Make sure that Scope of this function is same as function from where you are calling it.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question