473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

LinkButton to Label/Literal

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?

Nov 10 '06 #1
1 3847
on the click event, delete link controls and replace with labels.

-- bruce (sqlwork.com)
<rn**@rediffmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
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?

Nov 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pat Sagaser via .NET 247 | last post by:
I'm trying to add LinkButtons to a Repeater control using adynamic template. The docs state that you should be able tobubble the click event to the containing Repeater. There areplenty of examples in...
2
by: News | last post by:
Hi, I need help with datalist and linkbutton. I need a LinkButton to display in datalist if datafield "is_measure_customchecklist" in a db table set to true. Here is the code (in parts): ...
10
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I...
6
by: Joe | last post by:
I know that the Literal control will not render a <span> tag so I can not format its text. Other than this, what is the difference betwen the Literal control and the LiteralControl Control? How...
4
by: News | last post by:
Hi, I need help with datalist and linkbutton. I need a LinkButton to be visible in datalist only on the condition when datafield "is_measure_customchecklist" in a db table set to true. Here...
3
by: MRW | last post by:
I have a simple linkbutton and a function when it's clicked. It works perfectly in a regular .aspx page. However, when I place it inside the ContentPlaceHolder, it no longer works. It does...
2
by: WolfyUK | last post by:
Hello, I have a standard asp:DataGrid called CasesGrid that I wish to write my own paging controls for. The aim is to get something like the following rendered to screen: << First < Previous...
5
daJunkCollector
by: daJunkCollector | last post by:
What I am doing here should be obvious. I have a datagrid that displays data properly. I want to create a linkbutton within each row of the datagrid that toggles a label control in the same row...
0
by: HillBilly | last post by:
MasterPages again. Three LinkButtons are being used as styled tabs in the content page that will load a different ListView when a tab is selected: TabA, TabB or TabC. The LinkButtons are declared...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.