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

Respond to "delete" events on dynamic controls

Hi,

I'm dynamically creating a table of "delete" imagebuttons, that correspond
to files on the webserver. I want to respond to clicks of these buttons, so
I know to know what file to delete. Here is the code I'm using

Dim imgShow As New ImageButton
imgShow.CommandName = "Delete"
imgShow.CommandArgument = arrayOfFiles(i)
AddHandler imgShow.Command, AddressOf Image_Command
'Then I proceed to add this button to a table, and loop again for each file

Public Sub Image_Command(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs)
If e.CommandName = "Delete" then
'do the delete code
End If
End Sub

This works great, but in order to use the AddHandler, the button must still
exist on the postback page. My problem, this is a delete button, so I don't
want to recreate the button. Does anyone have any ideas on how I can handle
this easily?

Thanks
--Michael
Nov 18 '05 #1
1 1362
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Michael Ramey" <raterus@localhost> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

I'm dynamically creating a table of "delete" imagebuttons, that correspond
to files on the webserver. I want to respond to clicks of these buttons, so I know to know what file to delete. Here is the code I'm using

Dim imgShow As New ImageButton
imgShow.CommandName = "Delete"
imgShow.CommandArgument = arrayOfFiles(i)
AddHandler imgShow.Command, AddressOf Image_Command
'Then I proceed to add this button to a table, and loop again for each file
Public Sub Image_Command(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs)
If e.CommandName = "Delete" then
'do the delete code
End If
End Sub

This works great, but in order to use the AddHandler, the button must still exist on the postback page. My problem, this is a delete button, so I don't want to recreate the button. Does anyone have any ideas on how I can handle this easily?

Thanks
--Michael

Nov 18 '05 #2

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

Similar topics

32
by: Christopher Benson-Manica | last post by:
Is the following code legal, moral, and advisable? #include <iostream> class A { private: int a; public: A() : a(42) {}
13
by: gary | last post by:
Hi, We all know the below codes are dangerous: { int *p = new int; delete p; delete p; } And we also know the compilers do not delete p if p==NULL. So why compilers do not "p = NULL"...
8
by: John Baker | last post by:
Hi: Access 2000 W98! I have a table with numerous records in it, and am attempting to delete certain records that have been selected from it. These are selected based on the ID number in a...
2
by: Bob Tinsman | last post by:
This problem shows up in Firefox 1.5.0.1 and Rhino 1.6R2. I've found that if I have an XML node expression that ends in a filter, I can't use it with the delete operator. In the following...
7
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...
5
by: mkaushik | last post by:
Hi everyone, Im just starting out with C++, and am curious to know how "delete <pointer>", knows about the number of memory locations to free. I read somewhere that delete frees up space...
19
by: Daniel Pitts | last post by:
I have std::vector<Base *bases; I'd like to do something like: std::for_each(bases.begin(), bases.end(), operator delete); Is it possible without writing an adapter? Is there a better way? Is...
30
by: Medvedev | last post by:
i see serveral source codes , and i found they almost only use "new" and "delete" keywords to make they object. Why should i do that , and as i know the object is going to be destroy by itself at...
3
by: tvnaidu | last post by:
I compiled tinyxml files (.cpp files) and when I am linking to create final exe in Linux, I am getting lot of errors saying "undefiend reference" to "operator new" and "delete", any idea?. ...
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:
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
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: 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
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
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,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.