All,
I've been trying to get this question answered before and I got some hints,
but nothing that really fit my needs.
Here's what I'm aiming at:
I create x number of LinkButton at run-time in a UserControl, no probs.
However, when I click on on of them, I want to fetch which one of them that
was clicked and a value which is assigned via lnkbtn.ID (I could also take
the .text attribute, but I prefer the .ID).
Here is my simple sample code:
For a As Integer = 0 To 5
Dim lnkbtn As New LinkButton
lnkbtn.ID = "lnkbtn_" & CType(a, String)
lnkbtn.Text = "Linkbutton " & a
Me.Controls.Add (lnkbtn)
Next
So far so good. Now, how do I write a procedure that fetch the button
clicked? I want to get the text or the ID from that button.
I've been on Google, a number of forums and MSDN but can't find anything
that really explains this.
I'm writing everything in VB. One suggestion I got was to use a DataList,
but that doesn't really work for me.
Please note:
I DON'T add anything in design-time.
All help appreciated!
Thanks,
Fredrik 1 1567
Instead of this approach, why not set this information as part of the
CommandText. You can then wire-up a Command event to catch this instead of
the Click event.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"Fredrik Rodin" <ro***@dacsa.ne t> wrote in message
news:ud******** ******@TK2MSFTN GP12.phx.gbl... All,
I've been trying to get this question answered before and I got some
hints, but nothing that really fit my needs.
Here's what I'm aiming at:
I create x number of LinkButton at run-time in a UserControl, no probs.
However, when I click on on of them, I want to fetch which one of them
that was clicked and a value which is assigned via lnkbtn.ID (I could also take the .text attribute, but I prefer the .ID).
Here is my simple sample code:
For a As Integer = 0 To 5
Dim lnkbtn As New LinkButton lnkbtn.ID = "lnkbtn_" & CType(a, String) lnkbtn.Text = "Linkbutton " & a
Me.Controls.Add (lnkbtn)
Next
So far so good. Now, how do I write a procedure that fetch the button clicked? I want to get the text or the ID from that button.
I've been on Google, a number of forums and MSDN but can't find anything that really explains this.
I'm writing everything in VB. One suggestion I got was to use a DataList, but that doesn't really work for me.
Please note: I DON'T add anything in design-time.
All help appreciated!
Thanks, Fredrik
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Vi |
last post by:
Hi,
I'm trying to dinamically add LinkButton Controls to a web form. I do
something like:
for(i=1;i<=someVariable;i++)
{
LinkButton PageLink = new LinkButton();
PageLink.CommandName = i.ToString();
PageLink.Text = "Page " + i;
|
by: Fueled |
last post by:
Hi everyone!
I've made quite a lot of research on this, and I've tried a couple of
proposed solutions. Nothing has worked for me, but I feel there's not
much I'm missing. So I'm turning to this group and its experts for
answers.
So :
- I've got a main page (main.aspx)
- On this page, I've got a button (btnArchive), on whose click I
dynamically add a UserControl (archive.ascx) to the main page.
|
by: egholm |
last post by:
Hi
The code below is adding a dynamicly created LinkButton to a
placeholder control.
When I click the LinkButton it should call attLink_Click(), but it
dosen't happen.
What is wrong? Please help.
By the way, I'm using VS.NET 2005
|
by: Alex Maghen |
last post by:
I have a DataGrid control with a LinkButton command column that deletes the
row. What I want to do is set it up so that there's a client-side Confirm
alert BEFORE the actual Delete command gets called on the server-side. That's
easy to do with normal buttons, etc. as follows...
<asp:Button ID="ConfirmBtn" Text="ConfimMe!"
OnClientClick="if(!confirm('Are you sure?'))return false;"
OnClick="ConfirmBtnClickHandler" Runat="server" />
But...
|
by: rn5a |
last post by:
In a shopping cart app, suppose a user has placed 5 orders, I want to
show him 5 LinkButtons (one for each order) so that when he clicks the
first LinkButton, he would be shown the details of his first order.
Likewise if he clicks the second LinkButton, he will be shown the
details of the second order he had placed. The Text of the LinkButtons
will be 1 2 3 etc. So this user would see 1 2 3 4 5 as the
LinkButtons.
The problem is...
| |
by: OceanBreeze |
last post by:
I have added a LinkButton to a table cell programmatically inside the Page_Load method. I also added a custom event to that link button. The same custom event is valid for all the link buttons. The table gets successfully displayed on the browser with the LinkButton. When I click on the link button in the browser, my control does not go inside the custom even that I wrote for the link button.
I have a table control as ProviderTbl in which...
|
by: =?Utf-8?B?TWFyYyBXb29sZnNvbg==?= |
last post by:
Hi,
I have a strange issue occurring with LinkButtons that are dynamically added
to each (data) row of my DataGrid on that grid's ItemDataBound event. Each
LinkButton is assigned its own event handler to deal with the Command event,
but for some reason I can get this to work in a C# project but not in a newly
created VB.NET one.
The relevant VB.NET is as follows:
|
by: ree321 |
last post by:
I have a linkbutton which is added to a column in a datagrid
dynamically using a template I created. When I change the data in it
by not databinding and then when I later retreive the data from the
control after a post back it goes back to the value which was
dynamically bounded.
I have set up similar process with a checkbox template and it remebers
the value.
Are Linkbuttons not capable of this? and should I use something else?
|
by: Peter Larsen [CPH] |
last post by:
Hi,
The following sample shows a LinkButton in the HeaderTemplate of a Repeater
control.
The problem is that i'm not able to access the linkbutton in code (in the cs
file) as long as the linkbutton stays in the
repeater control - see the following line:
testLink.CommandArgument = "just testing"; or testLink.Text = "Some new
text";
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |