PDA

View Full Version : Cell with dynamic control


candykung
12-20-03, 07:52 AM
Dear Specialist,

I create an online shopping using cells of the table with hyperlink. I make use of the example of Visual.net


Public Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
' Total number of rows
Dim rowCnt As Integer
' Current row count
Dim rowCtr As Integer
' Total number of cells (columns)
Dim cellCtr As Integer
' Current cell counter
Dim cellCnt As Integer

rowCnt = CInt(TextBox1.Text)
cellCnt = CInt(TextBox2.Text)

For rowCtr = 1 To rowCnt
Dim tRow As New TableRow()
For cellCtr = 1 To cellCnt
Dim tCell As New TableCell()
' Mock up a product ID
Dim prodID As String
prodID = rowCtr & "_" & cellCtr

' Create literal text as control
Dim s As New LiteralControl()
s.Text = "Buy: "
tCell.Controls.Add(s) ' Add to cell
' Create Hyperlink Web Server control and add to cell
Dim h As New HyperLink()
h.Text = rowCtr & ":" & cellCtr
h.NavigateUrl = "http://www.microsoft.com/net"
tCell.Controls.Add(h)
' Add cell to row
tRow.Cells.Add(tCell) ' Add new TableCell object to row
Next cellCtr
Table1.Rows.Add(tRow) ' Add new row to table
Next rowCtr
End Sub


The question is : How to transfer the product ID with the hyperlink
http://www.microsoft.com/net ??
when I click the hyperlink, and request the product ID parameter in another web. There is nothing inside the prodID. Please help me !
The above example only mention to mock to prodID. How to transfer to another web page. There is no parameter inside the http://www.microsoft.com/net

Candy

Shane
12-25-03, 01:17 AM
Dear Specialist,

I create an online shopping using cells of the table with hyperlink. I make use of the example of Visual.net


Public Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
' Total number of rows
Dim rowCnt As Integer
' Current row count
Dim rowCtr As Integer
' Total number of cells (columns)
Dim cellCtr As Integer
' Current cell counter
Dim cellCnt As Integer

rowCnt = CInt(TextBox1.Text)
cellCnt = CInt(TextBox2.Text)

For rowCtr = 1 To rowCnt
Dim tRow As New TableRow()
For cellCtr = 1 To cellCnt
Dim tCell As New TableCell()
' Mock up a product ID
Dim prodID As String
prodID = rowCtr & "_" & cellCtr

' Create literal text as control
Dim s As New LiteralControl()
s.Text = "Buy: "
tCell.Controls.Add(s) ' Add to cell
' Create Hyperlink Web Server control and add to cell
Dim h As New HyperLink()
h.Text = rowCtr & ":" & cellCtr
h.NavigateUrl = "http://www.microsoft.com/net"
tCell.Controls.Add(h)
' Add cell to row
tRow.Cells.Add(tCell) ' Add new TableCell object to row
Next cellCtr
Table1.Rows.Add(tRow) ' Add new row to table
Next rowCtr
End Sub


The question is : How to transfer the product ID with the hyperlink
http://www.microsoft.com/net ??
when I click the hyperlink, and request the product ID parameter in another web. There is nothing inside the prodID. Please help me !
The above example only mention to mock to prodID. How to transfer to another web page. There is no parameter inside the http://www.microsoft.com/net

Candy
h.NavigateUrl = "http://www.yahoo.com/whatever.aspx?prod=" & prodID.ToString()

Is that what you need?