Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Jump to Tag in VB.NET / ASP.NET

Posted on 2006-07-19
8
Medium Priority
?
1,049 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

618 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