Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 2nd, 2005, 05:39 PM
Authorized User
 
Join Date: Feb 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default datagrid hyperlink problem

hi
i need help form all of u. i use datagrid in my asp.net page.i bound datagrid by using dataset.now each value in datagrid is work as hyperlink.when i click this datagrid values which work as hyperlink it redirect to desire page.for example datagrid bound by dataset and 10 values bound to datagrid.
when i click 1 it redirect to 1.aspx page
when i click 2 it redirect to 2.aspx page
when i click 3 it redirect to 3.aspx page
.... so on
like yahoo,hotmail mail box work.each link redirect to other page.
any one help me then plz..
 
Old November 2nd, 2005, 05:47 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

First of all, I think you're better off posting this in the ASP.NET 1.x Beginners forum located here: ASP.NET 1.0 and 1.1 Beginners

Secondly, I don't understand the question (if it is even a question and not a statement). So, if you do post in that forum, be sure to provide a lot more detail about your problem. Explain what works and what doesn't; what you have done to fix it, what code / sites / whatever other resources you used etc etc.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old November 14th, 2005, 01:40 PM
GAF GAF is offline
Registered User
 
Join Date: Mar 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to GAF
Default

well i think that u wanna do a list of URL's options from a table in a db, i made this in access for u, hopefully it's what you're asking for

        Dim cn As New System.Data.OleDb.OleDbConnection
        cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & _
    "C:\Inetpub\wwwroot\HLFromXml\db.mdb"
        Try
            Dim cm As New System.Data.OleDb.OleDbCommand("select * from url", cn)
            cm.Connection.Open()
            Dim ds As New DataSet
            Dim da As New System.Data.OleDb.OleDbDataAdapter(cm)
            da.Fill(ds)
            If ds.Tables(0).Rows.Count > 0 Then
                nt.ID = "Tabla"
                nt.EnableViewState = True
                nt.CssClass = "styles.css"
                For Each rw As DataRow In ds.Tables(0).Rows
                    Dim r As New Web.UI.webcontrols.TableRow ' creates new row
                    r.Visible = True
                    Dim tc1 As New Web.UI.WebControls.TableCell ' creates new cell
                    tc1.BorderStyle = BorderStyle.Solid
                    tc1.Width = Unit.Pixel(300)
                    tc1.Visible = True
                    Dim lb As New System.Web.UI.WebControls.Label
                    lb.Text = rw.Item("Descripcion") 'label filled with description field from db
                    tc1.Controls.Add(lb) 'adds textbox control to the cell
                    r.Cells.Add(tc1) 'adds cell to the row

                    Dim tc2 As New Web.UI.WebControls.TableCell ' creates new cell
                    tc2.BorderStyle = BorderStyle.Solid
                    tc2.Width = Unit.Pixel(400)
                    tc2.Visible = True
                    Dim hl As New System.Web.UI.WebControls.HyperLink
                    hl.NavigateUrl = rw.Item("URL") ' url from the db
                    hl.Text = rw.Item("Nombre") ' text given to the hyperlink
                    hl.ID = "Link" & rw.Item("Nombre")
                    hl.Target = "_blank"
                    tc2.Controls.Add(hl) ' adds hyper lynk control to the cell
                    r.Cells.Add(tc2) ' adds cell to the row
                    nt.Rows.Add(r)
                Next
            End If
        Catch ex As Exception
            If Not cn Is Nothing AndAlso cn.State = ConnectionState.Open Then
                cn.Close()
                cn = Nothing
            End If
        End Try

you must drag and drop a new table in your form's design window and name it nt, good luck !







Similar Threads
Thread Thread Starter Forum Replies Last Post
hyperlink in a datagrid? bhavna General .NET 1 January 25th, 2007 12:37 PM
DataGrid Hyperlink maddy137 ASP.NET 1.0 and 1.1 Professional 1 August 29th, 2006 07:18 AM
Datagrid Templatecolumn with Hyperlink ~Bean~ ASP.NET 1.0 and 1.1 Basics 0 July 18th, 2005 10:02 AM
Datagrid Hyperlink - new problem PLEASE HELP! skywalker1981 ASP.NET 1.x and 2.0 Application Design 2 April 5th, 2004 06:22 AM
DataGrid hyperlink Tangerine ASP.NET 1.x and 2.0 Application Design 2 March 24th, 2004 01:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.