473,394 Members | 1,893 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,394 software developers and data experts.

How to handle dynamically created buttons in ASP.NET using VB.net

As title, I used the following code to create a button and assign the event
handle dynamically.

private sub showOrderList()
...
Dim btnRemove As New Button
btnRemove.ID = "r" & strMyProductId
btnRemove.Text = "Remove"
btnRemove.Attributes("style")
="font-family:arial;font-size:8pt"
btnRemove.CausesValidation = False
AddHandler btnRemove.Click, AddressOf removeItem
.......
end sub

However, I found that the function removeItem never been called.
Can you tell me how can I fixed?
I found that most of the solution found in web are in C# and not in VB.net.
Would you tell me whether there are only C# solution?

thank you
Nov 18 '05 #1
1 3040
You may need to recreate the button

Dim objButton as New Button

objButton = Page.FindControl("r" & strMyProductId)

lblStatus.Text = objButton.Text

"ronaldo" <cs*****@joymail.com> wrote in message
news:uv**************@TK2MSFTNGP11.phx.gbl...
As title, I used the following code to create a button and assign the event handle dynamically.

private sub showOrderList()
...
Dim btnRemove As New Button
btnRemove.ID = "r" & strMyProductId
btnRemove.Text = "Remove"
btnRemove.Attributes("style")
="font-family:arial;font-size:8pt"
btnRemove.CausesValidation = False
AddHandler btnRemove.Click, AddressOf removeItem
......
end sub

However, I found that the function removeItem never been called.
Can you tell me how can I fixed?
I found that most of the solution found in web are in C# and not in VB.net. Would you tell me whether there are only C# solution?

thank you

Nov 18 '05 #2

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

Similar topics

0
by: RussC | last post by:
My C# app has a toolbar with 12 or so buttons on it, all created via the designer. In some circumstances we need to add one or two buttons to it dynamically. I have code that does this and it...
1
by: Gopal Krish | last post by:
I'm have coded a simple menu (using link buttons as menu items) in a user control to be reused across many ASPX pages. In the page_load method I dynamically create the link buttons as follows ...
2
by: djc | last post by:
On the page_load event I am querying a database and binding data to some text boxes, list boxes, and a repeater control. When the page loads it uses the value of one of the database fields (status)...
1
by: Lalit | last post by:
Hi, My application has two methods which creates buttons at runtime. In one method I am able to handle the events of the buttons created at run time, but in other I am not. The code structure...
1
by: AndrewMBaldwin | last post by:
Ok, this is going to be a long post, so I apologize in advance, but if it was an easy question I would have probably found an answer somewhere out here by now... The short story of this is that...
3
by: Mark | last post by:
Assume you want to dynamically add one to many link button controls to a web page dynamically at run time. Each link button needs to post back and execute code. As the link buttons are created at...
1
by: johnjsforum | last post by:
Buddies, I have a web page to create HTML buttons dynamically as in the “formDivColorPicker” function ////////////////////////////////////////////////////////////////////////////////////...
7
by: Malakie | last post by:
Hi all, I am trying to self teach VB .net to myself. Not sure what is worse, trying to accomplish this or thinking I can actually do it! ;-) Anyhow, Would someone be able to give me some...
1
by: semomaniz | last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.