Tom Chesley
Member
- Joined
- Jun 18, 2006
- Messages
- 12
- Programming Experience
- 1-3
I want to create a hyperlink in my datagrid at runtime because I will be changing my select according to what the user wishes to see.
included here is what i have so far witch functions well displaying correct information, but in the datagrid it doesnt do the hyperling like it doe here.
An example of the db is
Track_Name Author File_Name URL EVO_Version Track_Type
Dakar2 Tonka Dakar2.pod http://tonkas.no-ip.org/evo1/Dakar2.pod EVO1 Rally Race
Where do i go from here? Thank you in advance
included here is what i have so far witch functions well displaying correct information, but in the datagrid it doesnt do the hyperling like it doe here.
An example of the db is
Track_Name Author File_Name URL EVO_Version Track_Type
Dakar2 Tonka Dakar2.pod http://tonkas.no-ip.org/evo1/Dakar2.pod EVO1 Rally Race
Where do i go from here? Thank you in advance
VB.NET:
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Page_Load([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=2].Load[/SIZE]
[SIZE=2][COLOR=#008000]'Put user code to initialize the page here[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] SELcmd [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = "SELECT Track_Name, Author, File_Name, URL, EVO_Version, Track_Type FROM Tracks"[/SIZE]
[SIZE=2]Do_Select(SELcmd)[/SIZE]
[SIZE=2]dg.Caption = "Show Everything"[/SIZE]
[SIZE=2]dg.DataBind()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Do_Select([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] cmd)[/SIZE]
[SIZE=2][COLOR=#008000]'create SQL command[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] selCMD [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlClient.SqlCommand(cmd)[/SIZE]
[SIZE=2][COLOR=#008000]'create data adapter[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] daTrack [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlClient.SqlDataAdapter(selCMD)[/SIZE]
[SIZE=2][COLOR=#008000]'set the connector to the adapter[/COLOR][/SIZE]
[SIZE=2]daTrack.SelectCommand.Connection = con[/SIZE]
[SIZE=2][COLOR=#008000]'create dataset[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] ds [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] DataSet[/SIZE]
[SIZE=2][COLOR=#0000ff]Try[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]'fill the data adapter[/COLOR][/SIZE]
[SIZE=2]daTrack.Fill(ds, "Tracks")[/SIZE]
[SIZE=2][COLOR=#008000]'bind the datagrid[/COLOR][/SIZE]
[SIZE=2]dg.DataSource = ds[/SIZE]
[SIZE=2]dg.DataMember = "Tracks"[/SIZE]
[SIZE=2][COLOR=#0000ff]Catch[/COLOR][/SIZE][SIZE=2] ex [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Exception[/SIZE]
[SIZE=2]lblMsg.Text = ex.Message[/SIZE]
[SIZE=2][COLOR=#0000ff]Finally[/COLOR][/SIZE]
[SIZE=2]con.Close()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Try[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] btnEVO1_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] btnEVO1.Click[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] SELcmd [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = "SELECT Track_Name, Author, URL, EVO_Version, Track_Type FROM Tracks "[/SIZE]
[SIZE=2]SELcmd &= "WHERE EVO_Version = 'EVO1'"[/SIZE]
[SIZE=2]Do_Select(SELcmd)[/SIZE]
[SIZE=2]dg.Caption = "Show Evo 1 Only"[/SIZE]
[SIZE=2]dg.DataBind()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]