When I want to add a js confirm box to a delete button that is
positioned in the last column in a datagrid row I do the following in
the ItemDataBound event:
Dim delBtn As LinkButton = e.Item.Cells(10 ).Controls(0)
delBtn.Attribut es("onclick") = "javascript:ret urn confirm('you
sure?');"
If I want to change an image in a datagrid row I do the following in
the ItemDataBound event:
Dim imgX As System.Web.UI.W ebControls.Imag e =
CType(e.Item.Fi ndControl("imgX "), System.Web.UI.W ebControls.Imag e)
imgX.ImageUrl = "image.gif"
If I add a new column to the grid the reference using the cell number
breaks (e.Item.Cells(1 0).Controls(0) is now
e.Item.Cells(11 ).Controls(0)). The reference using the FindControl
method off course still works.
Is there a way to reference the Delete button so that adding new
columns don't break the code?
/M 2 1288
Hi
A simple solution would be just to use the fact that you know that the
"delete column" is the last column.
That is:
Count - 1
Regards,
Daniel Roth
MCSD.NET
thank. off course
On 19 May 2005 05:14:14 -0700, da********@gmai l.com wrote: Hi
A simple solution would be just to use the fact that you know that the "delete column" is the last column.
That is:
Count - 1
Regards,
Daniel Roth MCSD.NET This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: vcornjamb |
last post by:
Hello, I am developing a web form that contains some buttons and a data grid
which has as its last column link buttons that will delete the data
associated
with that row. Everything works fine, but users have requested a
confirmation
message pop up so the user can confirm the delete. I can not quite get
this to
work. Here are the facts:
I am working in the Microsoft Development Environment 2003 (Version
|
by: JenHu |
last post by:
Hi experts,
I want to add a delete button in my datagrid, and before it deletes
from database, I want to have a confirm dialog box for this deletion.
I am entry level to the vb.net, and don't know java or c#.
The problem is, when I tested the program, there is no pop-up
confirmation box for the deletion, can you show me what' wrong with
this code? Thank you.
|
by: DrData |
last post by:
I'm working on an ASP.Net application written in C#. On one page,
there are several datagrid controls used to display, edit and delete
detail records relating to the master record also displayed on that
page. Each row in each datagrid includes a Delete button (added at
runtime by the code-behind page as a ButtonColumn) and an Edit button
(added at runtime by the code-behind page as an EditCommandColumn).
What is the quickest, easiest and...
|
by: dmalhotr2001 |
last post by:
Hi,
I have a datagrid hypothetically with this data:
id | text | link
-------------------------------
1 | first row | delete button
2 | second row | delete button
I have 2 users with 2 DIFFERENT browser instances.
|
by: Jeff User |
last post by:
Hello
..NET 1.1, VS 2003, C# & asp.net
I have tried to follow msdn instructions and samples but I can not get
an event to fire for this button on the datagrid.
There has to be something obvious missing here, but after 2 days I am
ready to explode ! Please help.
To create the Delete button I selected the grid in design view,
clicked the "Columns" property and added the Delete button in the
| |
by: thebison |
last post by:
Hi all,
I hope someone can help with this relatively simple problem.
I am building a timesheet application using ASP.NET C# with Visual
Studio 2003.As it is only a protoype application, my database has been
made in MSDE.
I have a DataGrid, and have inserted a delete link button into it
through Property Builder. My Delete method works fine, however I would
like to insert a JScript popup to confirm, as otherwise users can just
|
by: rn5a |
last post by:
All the rows in a DataGrid are accompanied by a CheckBox. When a user
checks the rows & clicks a Button, the checked rows get deleted. For
e.g. assume that the DataGrid displays 10 rows. A user checks the rows
2, 4, 6, 8 & 10. When he clicks the Button, the page posts & the next
page displays only 5 rows i.e. row 1, 3, 5, 7 & 9. The checked rows are
populated in a ViewState variable & will have values like 2, 4, 6, 8,
10, (note that there...
|
by: amiga500 |
last post by:
Hello,
I have one basic simple question. When I have multiple records in the
datagrid as follows:
Code Product 1 Product 2 Product 3
11111 A B C
22222 D E F
33333 G H I
44444 J K L
|
by: Iain |
last post by:
Hi All
I am witing a web app using Delphi developer 2006 (C# app) and I have a
datagrid. Excuse the numptyness of the question. I have a datagrid with
the ability to Insert, Edit/Update and Delete records.
The following is the datagrid definition
<asp:datagrid id="Livery"
runat="server"
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |