Solved

Jump to Tag in VB.NET / ASP.NET

Posted on 2006-07-19
8
972 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

19 Experts available now in Live!

Get 1:1 Help Now