R
rn5a
This is how I am populating a Panel with dynamic LinkButtons (the no.
of LinkButtons that will be created will depend upon the no. of orders
a user has placed):
Sub Page_Init(obj As Object, ea As EventArgs)
Dim iCount As Integer = 1
Dim iTotalOrders As Integer
Dim lnkCount As LinkButton
'getting the total no. of orders a user has placed
For iCount = 1 To iTotalOrders
lnkCount = New LinkButton
lnkCount.ID = "lnkCount" & iCount
lnkCount.Text = iCount.ToString
lnkCount.CommandName = iCount
lnkCount.CommandArgument = Session("Order" & iCount)
AddHandler lnkCount.Command, AddressOf CommandCount
pnlLinks.Controls.Add(lnkCount)
Next
End Sub
Assume that a user has placed 4 orders. Thus he will be shown 4
LinkButtons - 1 2 3 4. When the user clicks the LinkButton whose
Text is 1, he is shown the details of the first order he had placed.
Similarly, if he clicks the LinkButton whose Text is 2, he is shown the
details of the second order he had placed so on & so forth. Note that
each LinkButton has a CommandName & CommandArgument.
What I want is when the user clicks the LinkButton whose Text is 1, 1
should no longer remain a LinkButton - it should just be a Label/plain
text (i.e. it should become "unclickable") but the rest should remain
as it is. Similarly, if the user clicks the LinkButton whose Text is,
say, 3, then 3 should become a Label/plain text (as is normally seen in
search pages on the web).
How do I do this?
of LinkButtons that will be created will depend upon the no. of orders
a user has placed):
Sub Page_Init(obj As Object, ea As EventArgs)
Dim iCount As Integer = 1
Dim iTotalOrders As Integer
Dim lnkCount As LinkButton
'getting the total no. of orders a user has placed
For iCount = 1 To iTotalOrders
lnkCount = New LinkButton
lnkCount.ID = "lnkCount" & iCount
lnkCount.Text = iCount.ToString
lnkCount.CommandName = iCount
lnkCount.CommandArgument = Session("Order" & iCount)
AddHandler lnkCount.Command, AddressOf CommandCount
pnlLinks.Controls.Add(lnkCount)
Next
End Sub
Assume that a user has placed 4 orders. Thus he will be shown 4
LinkButtons - 1 2 3 4. When the user clicks the LinkButton whose
Text is 1, he is shown the details of the first order he had placed.
Similarly, if he clicks the LinkButton whose Text is 2, he is shown the
details of the second order he had placed so on & so forth. Note that
each LinkButton has a CommandName & CommandArgument.
What I want is when the user clicks the LinkButton whose Text is 1, 1
should no longer remain a LinkButton - it should just be a Label/plain
text (i.e. it should become "unclickable") but the rest should remain
as it is. Similarly, if the user clicks the LinkButton whose Text is,
say, 3, then 3 should become a Label/plain text (as is normally seen in
search pages on the web).
How do I do this?