?
Solved

Jump to Tag in VB.NET / ASP.NET

Posted on 2006-07-19
8
Medium Priority
?
1,040 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

752 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