473,809 Members | 2,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stupid forms question

C# newbie here.

I'm creating a page that will use a repeater control to display
thumbnail images. I want to have a button next to each image so that
the user can delete a particular image by clicking on the 'delete'
button next to it.

I'm having trouble determining how to pass the id of the image to my
codebehind when the user clicks a particular delete button.

So that my example code has less clutter I'll not use a repeater
control for my example and I'll just show one button.

Here's some pseudo-code for what I'd like to do.

<asp:Button id="DeleteImage " Runat="server" Text="Delete This image"
onClick="Delete Image(imageID)"/>

And my code-behind would be something like this

public void DeleteImage(int imageID)
{
// code here would delete the image
}

How can I actually pass the imageID to my codebehind? Again keep in
mind that there could be any number of images on this page. I want to
call one method and pass the id to it.

I realize I could have one button at the bottom of the form and use
radio buttons next to each image and delete an image based off of which
radio button was selected. I don't want to do it that way for a number
of reasons.

I'm sure this is a stupid question but none of my C# books explain how
to do something like this.

Any input is appreciated.

Jan 2 '06 #1
0 905

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

Similar topics

119
4643
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see, http://www.alistapart.com/articles/betterliving/ I read on http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnnetdep/html/netfxcompat.asp It said they changed stuff like this
4
2299
by: Mark | last post by:
the Following bit of code doesn't work. It seems to respond to the second, starting with 'add iif statement for Good Practice', but not to the first, starting 'add iif statement for archived' Help me to sort this out, it has taken me almost a week to wade through and it still won't work. Select Case Forms("frmForce").OpenArgs
2
3356
by: Dutchy | last post by:
Hi there, After spending several hours trying all I could imagine and search for in Google I gave up. In a continuous form I want to sort the choosen column by clicking the header (label) of that column. I even want to sort up and down if one clicks again on the same header. No problem so far, all works well for one column. Now I want to sort on the first choosen column ASC or DESC and additionally on a second column ASC. I use the...
2
1571
by: dawn | last post by:
Hi, I'm writing a Windows Form app, using c# (and believe me when I say I'm a newbie). The program needs two forms to functionate and I have to be able to write code that switches between the forms (i.e. the have to be co-existent and I need to change the Active Form). I launch the second form from the menu bar in the frst form. How can I make this second form "known" throughout the entire code, so that I can access (i.e. render active)...
2
1216
by: Jander Clan | last post by:
Hi to all... If i open a new web control library and i make a class that for example inherits from a dropdownlist, is a web control or web custom control, or a user control, i dont see the differences... Thanks in advance. Jander Clan
1
1230
by: Buddy Ackerman | last post by:
I'm trying to modify an ASCX written in C#. There is code embedded with the HTML and some lines start with <%#, what is the # for (is it like <%= in VB.NET)? So, I have a line that looks like this: <td><%# Server.HtmlEncode(((DesktopAlert.Web.User)Container.DataItem).Username) %></td> However, I want to do a string replace on the Username so I tried to do this: <%
7
1286
by: Trev | last post by:
Hey, I just want to know (i know i should know this) how can i show up another form? I have 2 forms and the first one has a button on it that when i click the button i want the second form to show up (and the first form disappear), and i also want another button on the second form to return to the first form.
6
1620
by: Adam Smith | last post by:
I have posted this and similar questions repeatedly and can't even raise a single response. I am being led to believe that this then 'Must be a stupid question' although people say that there is no stupid question. Is that another for political correctness I am attempting an install of 7.4.3 on FreeBSD O/S 4.9, apparently remnants of 7.3.x are scattered around on the disk from (a) previous ports installation, causing mutex_lock/unlock,...
4
1210
by: adam | last post by:
I constantly have a delima calling functions inbetween forms, for example in a project, in frmMain.cs , I have a function called RefMain();, I would like to call it in frmAdd.cs, but none of the following methods work: 1: frmMain frm; frm.RefMain(); 2:
0
9603
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,...
0
10643
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, 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...
0
10378
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10121
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7664
isladogs
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...
0
5550
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...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
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
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.