i was using the following on a serverside button on a form
If (Not Page.IsPostBack ) Then
Me.BtnDelete.At tributes.Add("o nclick","return confirm('Are you sure you want
to delete?');")
End If
but was wondering how i would go about doing the same for a button within a
column? i cannot see btnDelete in the code-behind page
Cheers,
Craig 4 1913
Hook into the ItemDataBound event of the DataGrid. There'll you'll be able
to find BtnDelete via:
dim delete as Button = ctype(e.Item.Fi ndControl("btnD elete"), button)
check out my tutorial on databinding for more info: http://openmymind.net/databinding/index.html
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"Craig G" <cr**********@y arrasoftware.co m> wrote in message
news:ul******** *****@TK2MSFTNG P12.phx.gbl... i was using the following on a serverside button on a form If (Not Page.IsPostBack ) Then
Me.BtnDelete.At tributes.Add("o nclick","return confirm('Are you sure you
want to delete?');")
End If
but was wondering how i would go about doing the same for a button within
a column? i cannot see btnDelete in the code-behind page
Cheers, Craig
nice one, never knew about the ItemDataBound event
dim delete as Button = ctype(e.Item.Fi ndControl("btnD elete"), button)
delete.Attribut es.Add("onclick ", "return confirm('Are you sure you want to
delete?');")
having tried the above, i keep gettin the following error :-
Object reference not set to an instance of an object
Cheers,
Craig
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:um******** ******@tk2msftn gp13.phx.gbl... Hook into the ItemDataBound event of the DataGrid. There'll you'll be
able to find BtnDelete via:
dim delete as Button = ctype(e.Item.Fi ndControl("btnD elete"), button)
check out my tutorial on databinding for more info: http://openmymind.net/databinding/index.html
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/
"Craig G" <cr**********@y arrasoftware.co m> wrote in message news:ul******** *****@TK2MSFTNG P12.phx.gbl... i was using the following on a serverside button on a form If (Not Page.IsPostBack ) Then
Me.BtnDelete.At tributes.Add("o nclick","return confirm('Are you sure you want to delete?');")
End If
but was wondering how i would go about doing the same for a button
within a column? i cannot see btnDelete in the code-behind page
Cheers, Craig
delete is nothing..this is possible under a number of circumstances.
dim delete as Button = ctype(e.Item.Fi ndControl("btnD elete"), button)
if not delete is nothing then
delete.Attribut es.Add("onclick ", "return confirm('Are you sure you want to
delete?');")
end if
You should check for e.Item.ItemType and make sure it's either an
ListItemType.It em or ListItemType.Al ternatingItem. ItemDataBound fires even
when the header/footer/paging is being created, in those templates you don't
have a btnDelete, which is why you are getting a null reference. The
tutorial goes over that stuff.
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"Craig G" <cr**********@y arrasoftware.co m> wrote in message
news:eO******** ******@TK2MSFTN GP12.phx.gbl... nice one, never knew about the ItemDataBound event
dim delete as Button = ctype(e.Item.Fi ndControl("btnD elete"), button)
delete.Attribut es.Add("onclick ", "return confirm('Are you sure you want to delete?');")
having tried the above, i keep gettin the following error :-
Object reference not set to an instance of an object
Cheers, Craig
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:um******** ******@tk2msftn gp13.phx.gbl... Hook into the ItemDataBound event of the DataGrid. There'll you'll be able to find BtnDelete via:
dim delete as Button = ctype(e.Item.Fi ndControl("btnD elete"), button)
check out my tutorial on databinding for more info: http://openmymind.net/databinding/index.html
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/
"Craig G" <cr**********@y arrasoftware.co m> wrote in message news:ul******** *****@TK2MSFTNG P12.phx.gbl... i was using the following on a serverside button on a form If (Not Page.IsPostBack ) Then
Me.BtnDelete.At tributes.Add("o nclick","return confirm('Are you sure
you want to delete?');")
End If
but was wondering how i would go about doing the same for a button within a column? i cannot see btnDelete in the code-behind page
Cheers, Craig
nice one cheers.
Craig
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uU******** ********@TK2MSF TNGP09.phx.gbl. .. delete is nothing..this is possible under a number of circumstances.
dim delete as Button = ctype(e.Item.Fi ndControl("btnD elete"), button) if not delete is nothing then delete.Attribut es.Add("onclick ", "return confirm('Are you sure you want
to delete?');")
end if
You should check for e.Item.ItemType and make sure it's either an ListItemType.It em or ListItemType.Al ternatingItem. ItemDataBound fires
even when the header/footer/paging is being created, in those templates you
don't have a btnDelete, which is why you are getting a null reference. The tutorial goes over that stuff.
Karl -- MY ASP.Net tutorials http://www.openmymind.net/
"Craig G" <cr**********@y arrasoftware.co m> wrote in message news:eO******** ******@TK2MSFTN GP12.phx.gbl... nice one, never knew about the ItemDataBound event
dim delete as Button = ctype(e.Item.Fi ndControl("btnD elete"), button)
delete.Attribut es.Add("onclick ", "return confirm('Are you sure you want
to delete?');")
having tried the above, i keep gettin the following error :-
Object reference not set to an instance of an object
Cheers, Craig
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:um******** ******@tk2msftn gp13.phx.gbl... Hook into the ItemDataBound event of the DataGrid. There'll you'll be able to find BtnDelete via:
dim delete as Button = ctype(e.Item.Fi ndControl("btnD elete"), button)
check out my tutorial on databinding for more info: http://openmymind.net/databinding/index.html
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/
"Craig G" <cr**********@y arrasoftware.co m> wrote in message news:ul******** *****@TK2MSFTNG P12.phx.gbl... > i was using the following on a serverside button on a form > If (Not Page.IsPostBack ) Then > > Me.BtnDelete.At tributes.Add("o nclick","return confirm('Are you sure you want > to delete?');") > > End If > > but was wondering how i would go about doing the same for a button
within a > column? i cannot see btnDelete in the code-behind page > > Cheers, > Craig > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andrés Giraldo |
last post by:
Hi!
I'm adding an asp button to a datagrid on the ItemDataBound event, when
the user clicks on this button, I basically remove the button and create
other 2 buttons... my problem is.. the 2 last buttons doesn't fire his
events... what I'm doing wrong?
Thanks!
|
by: Mike Irwin |
last post by:
I'm trying to add an attribute to each column header of a DataGrid. I know
that I need to do this within the ItemCreated event of the DataGrid, but I'm
stuck on how to go any further.
I found some info on MSDN on how to do this, but it's doesn't clear any
thing up for me Here's the paragraph and a link to the document:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpcondatagridwebservercontrol.asp
...
|
by: Phil Townsend |
last post by:
I need to add a button to a datagrid. I have tried using the
ButtonColumn and have also tried adding a button to a templatecolumn >
itemtemplate. Whatever I have tried doesn't work, nor does it produce
errors. The method i have specified to execute is never reached. Can
anybody tell what I am doing wrong? Thanks...
webform code:
<form id="Form1" method="post" runat="server">
<asp:datagrid id="dgconcept" runat="server"
|
by: Jim Heavey |
last post by:
Trying to figure out the technique which should be used
to add rows to a datagrid. I am thinking that I would
want an "Add" button on the footer, but I am not quite
sure how to do that. Is that the best method? Do you
have a sample of how to do this?
|
by: sumit |
last post by:
Hi,
I want to add one java script function on the click of
page button of datagrid. But how to get UI control of page
button so that i should be able to add attribute for
onClick event.
Please suggest
Sumit
| |
by: Sjaakie Helderhorst |
last post by:
Hello,
I need to add a Javascript event (onClick) to a servercontrol
(asp:checkbox). Checkbox is named 'cbDoMail'.
Assumed that 'cbDoMail.Attributes.Add("onClick", "doJavascriptThing()")
would do the job, unfortunately it didn't.
Can anyone point me in the right direction?
Thanks!
|
by: Bart Schelkens |
last post by:
Hi,
I have another question.
On my asp-page I put a label.
I manually create a table and set that table in the text of the label.
This way my table is displayed.
My question is how can i add 2 columns that contain buttons to that table.
The last two columns of my table need to contain buttons to edit or delete a
|
by: Samy |
last post by:
Hi There,
I have a label in a datagrid which I make it a input type = radio in
ItemDataBound so that radio buttons are shown in the datagrid.
This is how I have it...
ASPX...
<asp:Label ID="_selectedRBtn" Runat="server"></asp:Label>
ASPX.CS
|
by: Dhruba Bandopadhyay |
last post by:
I know that JavaScript lets us add:
ondragenter, ondragover, ondragleave, ondrop
events to normal HTML table td tags. This lets us do highlighting of
table cells/rows, and capture drag & drop events. So to handle
ondrop we can use JavaScript:
this.OnDrop = function(obj) {
obj.parentElement.style.backgroundColor = "white";
|
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: 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,...
| |
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...
|
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: 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...
|
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: 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.
| |