Solved

Jump to Tag in VB.NET / ASP.NET

Posted on 2006-07-19
8
989 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
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.…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now