Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to handle dynamically created buttons in ASP.NET using VB.net

Reply
Thread Tools

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

 
 
ronaldo
Guest
Posts: n/a
 
      07-22-2004
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


 
Reply With Quote
 
 
 
 
anthony
Guest
Posts: n/a
 
      07-22-2004
You may need to recreate the button

Dim objButton as New Button

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

lblStatus.Text = objButton.Text



"ronaldo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
Created Radio Buttons displaying as if they were conventional buttons Dr. Leff Javascript 3 10-15-2007 09:47 PM
Created Radio Buttons displaying as if they were conventional buttons Dr. Leff Javascript 3 10-15-2007 05:18 AM
Managing ViewState of a dynamically created Custom Composite Server Control -(where the original is also dynamically created) dickster ASP .Net Building Controls 0 12-08-2005 09:32 AM
Creating onClick event for dynamically (programatically) created buttons Hrvoje Vrbanc ASP .Net 1 07-10-2003 04:55 PM



Advertisments