473,670 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete button not firing

Hi,

I have a delete button in the item template of my datagrid, when I click it
the function for the Insert button is executed instead of the delete button.
When I step through in debug, the doAction function is never entered. Below
is my code. Do you see any errors? Thanks, Andy

<asp:datagrid id="dgdANSI835 " runat="server" OnItemCommand=" doAction"
ShowFooter="Fal se" Font-Names="verdana" BorderColor="#C CCC99"
BackColor="#CCC C99" Font-Size="8pt" AutoGenerateCol umns="False"
DataKeyField="i nfo_id" >
.....
<asp:TemplateCo lumn>
<HeaderTemplate >
<asp:LinkButt on CommandName="In sert" Text="Add" ID="btnAdd" Runat="server" />
</HeaderTemplate>
<ItemTemplate >
<asp:Button CommandName="De lete" Text="Del" ID="btnDelete"
Runat="server"> </asp:Button>
</ItemTemplate>
</asp:TemplateCol umn>
.....
public void doAction(object sender, DataGridCommand EventArgs e)
{
if (e.CommandName == "Insert")
{
dgdANSI835.Show Footer=true;
}
if (e.CommandName == "Delete")
{
DeleteRow();
}
}
--
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...p-net/200506/1
Nov 19 '05 #1
2 3796
My grids are set up the same way.
(But they work. <g>)

The only thing I noticed is the signature of your Sub:

public void doAction(object sender, DataGridCommand EventArgs e)

Mine uses:
public void doAction(object source , DataGridCommand EventArgs e)

Not sure if the difference between source and sender is your problem.
--
Joe Fallon

"Andy Sutorius via DotNetMonster.c om" <fo***@nospam.D otNetMonster.co m> wrote
in message news:4F******** ***@DotNetMonst er.com...
Hi,

I have a delete button in the item template of my datagrid, when I click
it
the function for the Insert button is executed instead of the delete
button.
When I step through in debug, the doAction function is never entered.
Below
is my code. Do you see any errors? Thanks, Andy

<asp:datagrid id="dgdANSI835 " runat="server" OnItemCommand=" doAction"
ShowFooter="Fal se" Font-Names="verdana" BorderColor="#C CCC99"
BackColor="#CCC C99" Font-Size="8pt" AutoGenerateCol umns="False"
DataKeyField="i nfo_id" >
....
<asp:TemplateCo lumn>
<HeaderTemplate >
<asp:LinkButt on CommandName="In sert" Text="Add" ID="btnAdd" Runat="server"
/>
</HeaderTemplate>
<ItemTemplate >
<asp:Button CommandName="De lete" Text="Del" ID="btnDelete"
Runat="server"> </asp:Button>
</ItemTemplate>
</asp:TemplateCol umn>
....
public void doAction(object sender, DataGridCommand EventArgs e)
{
if (e.CommandName == "Insert")
{
dgdANSI835.Show Footer=true;
}
if (e.CommandName == "Delete")
{
DeleteRow();
}
}
--
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...p-net/200506/1

Nov 19 '05 #2
Hi,

The event is not firing because, I think you are calling the
datagrid.databi nd method somewhere in Page_Load. You have to check the
IsPostBack property so that the datagrid gets filled only once. This will
fire the appropriate event.

Hope this helps.

"Andy Sutorius via DotNetMonster.c om" wrote:
Hi,

I have a delete button in the item template of my datagrid, when I click it
the function for the Insert button is executed instead of the delete button.
When I step through in debug, the doAction function is never entered. Below
is my code. Do you see any errors? Thanks, Andy

<asp:datagrid id="dgdANSI835 " runat="server" OnItemCommand=" doAction"
ShowFooter="Fal se" Font-Names="verdana" BorderColor="#C CCC99"
BackColor="#CCC C99" Font-Size="8pt" AutoGenerateCol umns="False"
DataKeyField="i nfo_id" >
.....
<asp:TemplateCo lumn>
<HeaderTemplate >
<asp:LinkButt on CommandName="In sert" Text="Add" ID="btnAdd" Runat="server" />
</HeaderTemplate>
<ItemTemplate >
<asp:Button CommandName="De lete" Text="Del" ID="btnDelete"
Runat="server"> </asp:Button>
</ItemTemplate>
</asp:TemplateCol umn>
.....
public void doAction(object sender, DataGridCommand EventArgs e)
{
if (e.CommandName == "Insert")
{
dgdANSI835.Show Footer=true;
}
if (e.CommandName == "Delete")
{
DeleteRow();
}
}
--
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...p-net/200506/1

Nov 19 '05 #3

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

Similar topics

14
5455
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I have been able to come. I added a little asp.net code and an asp.net button and cannot get it to
6
1665
by: Dotnet Guy | last post by:
I want to add a confirmation dialog box before I delete the records in my form. I have a piece of javascript code in html that checks for confirmation. But the main issue lies in calling this javascript function on pagebehind. function confirm_delete() { if (confirm("Are you sure you want
2
9843
by: ~~~ .NET Ed ~~~ | last post by:
I have a problem (don't we all?). I have a web form with multiple modules, some of these modules have an ASP.NET (server run) button. OK, now I have UserControlX which has one such button (say Login). In that user control I defined both the Command and Click events for the button and placed a break point on it (in addition to traces). This user control is then included in the main form within the Form element/tags. Both the user control...
3
1320
by: Trond | last post by:
I added a delete button to a datagrid. I also added an event: private void dgMessages_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) I added this to event: Label1.Text=dgMessages.DataKeys.ToString(); but the label is not set to the DataKey.
5
1964
by: csgraham74 | last post by:
Hi guys, I posted regarding this issue the other day but i still dont have an answer to my problem. Basically i have imported asp.net pages from dreamweaver into visual studio. Ive added a few controls that ive copied in from another asp.net page that i built within visual studio. The problem is that the asp:button does not fir an event and therefore my code behind it wont work. The page load event is firing correctly so i think the...
5
6694
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
3
5504
by: Jay | last post by:
I am on the 2.0 framework and have run the c:\windows\microsoft.net \framework\v1.1.4322\aspnet_regiis.exe -c and had no success. About half of the buttons on my webforms are firing and the other half are not, primarily anything on the Master is firing but those in the content pane are not. This was working fine yesterday!! I've reviewed all the code changes and can't seem to find a culprit. Here's one example of what I'm trying to...
0
1274
by: pavankumar106 | last post by:
Hi im stuck in sm simple pb ..im having a datalist in wich im having images and each image have a delete button below it.now wen I press delete button I shud be able to delete that image in dataset and bind it to datalist.i ve tried to run the code in button click event of delete,button command click event and also datalist delete command event.But its not gng to break point at all.. Can u say da reason y its not firing..:) n can anyone tell me...
5
5880
by: Tony | last post by:
I am continuing to develop an Access 2007 application which was originally converted from Access 2003. In Access 2003 I was able to disable the Access Close button in the top righthand corner of the screen. I have been unable to find any way to disable this button in Access 2007 and subsequently I have been forced to find ways to detect and handle the situations after the Access Close button has been clicked. I have been largely...
0
8903
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
8815
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...
1
6216
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
5686
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();...
0
4213
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
4393
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2802
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
2044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1795
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.