473,606 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete button on DataGrid not firing

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
properties page.
Then, I switched to the lightening bolt (events) and double clicked
the
"DeleteComm and" entry. On the C# page this created the :
private void dgPrivs_DeleteC ommand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{ etc....}
event procedure. It also apparently created the
initialize component entry:
this.dgPrivs.De leteCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);

Clicking the Delete button on the pages causes it to post back, but
this event code never runs.

aspx page bit:
.......
<asp:datagrid id="dgPrivs" style="Z-INDEX: 110; LEFT: 256px; POSITION:
absolute; TOP: 176px" runat="server"
BackColor="#E0E 0E4" BorderStyle="Ou tset" AutoGenerateCol umns="False">
<Columns>
<asp:BoundColum n DataField="Gran tor" ReadOnly="True"
HeaderText="Gra ntor"></asp:BoundColumn >
<asp:BoundColum n DataField="Gran tee" ReadOnly="True"
HeaderText="Gra ntee"></asp:BoundColumn >
<asp:BoundColum n DataField="Obje ct_Type" ReadOnly="True"
HeaderText="Obj ect Type"></asp:BoundColumn >
<asp:BoundColum n DataField="Obje ct_Name" ReadOnly="True"
HeaderText="Obj ect Name"></asp:BoundColumn >
<asp:BoundColum n DataField="Priv ilege_Type" ReadOnly="True"
HeaderText="Pri vilege"></asp:BoundColumn >
<asp:ButtonColu mn Text="Delete" ButtonType="Pus hButton"
CommandName="De lete"></asp:ButtonColum n>
</Columns>

C# code bits
private void InitializeCompo nent()
{
this.dgPrivs.De leteCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);
this.Load += new System.EventHan dler(this.Page_ Load);
}
private void dgPrivs_DeleteC ommand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
string t ="ldsld";
t = t + "Resotr";
}
Do I need to add something else in here anywhere?
Is there anything else I should be looking for?

Thanks
Jeff
Feb 4 '06 #1
5 6689
Jeff,

I use VB, but the syntax is very similar, so you should be able to grok
this.

First off, trap the ItemCommand event of the datagrid:

Private Sub dgOuter_ItemCom mand(ByVal source As System.Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
dgOuter.ItemCom mand
'Capture events from datagrid
Dim b As LinkButton
b = e.CommandSource
If b.Text = "Delete" Then
'// <your specifics here>: call your delete function
me.lblMyMessage ToTheUser.Text = "You clicked to delete row: " &
me.dgOuter.Sele ctedIndex.ToStr ing
End If
End Sub

What I commonly do is have a hidden panel above the datagrid that holds a
confirmation request plus two buttons, the cancel and the confirm. I then
set the CommandArgument of the confirm button to equal the ID of the item
displayed in the datagrid. I can then pass that ID to the SQL procedure
performing the delete.

Like this (assuming your datagrid has the primarykey ID in column zero,
which may optionally be hidden):

Private Sub dgOuter_ItemCom mand(ByVal source As System.Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
dgOuter.ItemCom mand
'Capture events from datagrid
Dim b As LinkButton
b = e.CommandSource
If b.Text = "Delete" Then
'<your specifics here>
me.cmdDeleteCon firm.CommandArg ument = e.Item.Cells(0) .Text
'call your delete function
me.ShowDeleteCo nfirm()
End If
End Sub

private sub ShowDeleteConfi rm()
' Show the confirm panel
me.pnlDeleteCon firm.visible = true
end sub

private sub cmdDeleteConfir m_Click(...) handles cmdDeleteConfir m.click
'User has clicked delete confirm
'Action the delete on datasource
'... sql connection setup, etc.
'... (I use the MS - DAAB for this)
'...
'e.g. Add PK of item as parameter to sql sproc
cmd.AddInParame ter("@yourPK_ID ", dbtype.Int32,
cint(me.cmdDele teConfirm.Comma ndArgument))
end sub

If you are wondering about the MS - DAAB comment, see MSDN Mag's Data Points
article by Jon Papa at:
http://msdn.microsoft.com/msdnmag/is...07/DataPoints/. But note that a
new version is coming for 2.0.

Hope that helps.

Al

"Jeff User" <je*******@hotm ail.com> wrote in message
news:04******** *************** *********@4ax.c om...
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
properties page.
Then, I switched to the lightening bolt (events) and double clicked
the
"DeleteComm and" entry. On the C# page this created the :
private void dgPrivs_DeleteC ommand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{ etc....}
event procedure. It also apparently created the
initialize component entry:
this.dgPrivs.De leteCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);

Clicking the Delete button on the pages causes it to post back, but
this event code never runs.

aspx page bit:
......
<asp:datagrid id="dgPrivs" style="Z-INDEX: 110; LEFT: 256px; POSITION:
absolute; TOP: 176px" runat="server"
BackColor="#E0E 0E4" BorderStyle="Ou tset" AutoGenerateCol umns="False">
<Columns>
<asp:BoundColum n DataField="Gran tor" ReadOnly="True"
HeaderText="Gra ntor"></asp:BoundColumn >
<asp:BoundColum n DataField="Gran tee" ReadOnly="True"
HeaderText="Gra ntee"></asp:BoundColumn >
<asp:BoundColum n DataField="Obje ct_Type" ReadOnly="True"
HeaderText="Obj ect Type"></asp:BoundColumn >
<asp:BoundColum n DataField="Obje ct_Name" ReadOnly="True"
HeaderText="Obj ect Name"></asp:BoundColumn >
<asp:BoundColum n DataField="Priv ilege_Type" ReadOnly="True"
HeaderText="Pri vilege"></asp:BoundColumn >
<asp:ButtonColu mn Text="Delete" ButtonType="Pus hButton"
CommandName="De lete"></asp:ButtonColum n>
</Columns>

C# code bits
private void InitializeCompo nent()
{
this.dgPrivs.De leteCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);
this.Load += new System.EventHan dler(this.Page_ Load);
}
private void dgPrivs_DeleteC ommand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
string t ="ldsld";
t = t + "Resotr";
}
Do I need to add something else in here anywhere?
Is there anything else I should be looking for?

Thanks
Jeff

Feb 4 '06 #2
Hi Jeff,

Most common reason to cause datagrid events not being properly fired is that
datagrid’s EnableViewState to be disabled (sometimes indirectly, e.g. its
disabled viewstate in container, page, usercontrol, and so on). Hence, please
check the property first.

And sometimes, some other reasons also cause this kind of problem.
Yesterday, I found one developer’s datagrid data-binding function in wrong
place. In that case, if we don’t read whole code, we can never find out
what’s wrong.
HTH

Elton Wang
"Jeff User" wrote:
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
properties page.
Then, I switched to the lightening bolt (events) and double clicked
the
"DeleteComm and" entry. On the C# page this created the :
private void dgPrivs_DeleteC ommand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{ etc....}
event procedure. It also apparently created the
initialize component entry:
this.dgPrivs.De leteCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);

Clicking the Delete button on the pages causes it to post back, but
this event code never runs.

aspx page bit:
.......
<asp:datagrid id="dgPrivs" style="Z-INDEX: 110; LEFT: 256px; POSITION:
absolute; TOP: 176px" runat="server"
BackColor="#E0E 0E4" BorderStyle="Ou tset" AutoGenerateCol umns="False">
<Columns>
<asp:BoundColum n DataField="Gran tor" ReadOnly="True"
HeaderText="Gra ntor"></asp:BoundColumn >
<asp:BoundColum n DataField="Gran tee" ReadOnly="True"
HeaderText="Gra ntee"></asp:BoundColumn >
<asp:BoundColum n DataField="Obje ct_Type" ReadOnly="True"
HeaderText="Obj ect Type"></asp:BoundColumn >
<asp:BoundColum n DataField="Obje ct_Name" ReadOnly="True"
HeaderText="Obj ect Name"></asp:BoundColumn >
<asp:BoundColum n DataField="Priv ilege_Type" ReadOnly="True"
HeaderText="Pri vilege"></asp:BoundColumn >
<asp:ButtonColu mn Text="Delete" ButtonType="Pus hButton"
CommandName="De lete"></asp:ButtonColum n>
</Columns>

C# code bits
private void InitializeCompo nent()
{
this.dgPrivs.De leteCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);
this.Load += new System.EventHan dler(this.Page_ Load);
}
private void dgPrivs_DeleteC ommand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
string t ="ldsld";
t = t + "Resotr";
}
Do I need to add something else in here anywhere?
Is there anything else I should be looking for?

Thanks
Jeff

Feb 4 '06 #3
Elton
In the properties window for the datagrid, the EnableViewState is set
to true. I searched the entire project for the phrase "viewstate" and
it was not found, so I take it, it is not being changed
programatically .

Every piece of my code that has any references at all to either my
datagrid or the button is listed in my code below. Not sure what you
meant by the "datagrid data-binding function", but if you don't see
something in my code that should be there, could you let me know?

I also tried adding the dgPrivs_ItemCom mand event to my C# code, but
that also does not fire when button is clicked.

Thanks again
Jeff


On Sat, 4 Feb 2006 13:30:19 -0800, "Elton W"
<El****@discuss ions.microsoft. com> wrote:
Hi Jeff,

Most common reason to cause datagrid events not being properly fired is that
datagrid’s EnableViewState to be disabled (sometimes indirectly, e.g. its
disabled viewstate in container, page, usercontrol, and so on). Hence, please
check the property first.

And sometimes, some other reasons also cause this kind of problem.
Yesterday, I found one developer’s datagrid data-binding function in wrong
place. In that case, if we don’t read whole code, we can never find out
what’s wrong.
HTH

Elton Wang
"Jeff User" wrote:
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
properties page.
Then, I switched to the lightening bolt (events) and double clicked
the
"DeleteComm and" entry. On the C# page this created the :
private void dgPrivs_DeleteC ommand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{ etc....}
event procedure. It also apparently created the
initialize component entry:
this.dgPrivs.De leteCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);

Clicking the Delete button on the pages causes it to post back, but
this event code never runs.

aspx page bit:
.......
<asp:datagrid id="dgPrivs" style="Z-INDEX: 110; LEFT: 256px; POSITION:
absolute; TOP: 176px" runat="server"
BackColor="#E0E 0E4" BorderStyle="Ou tset" AutoGenerateCol umns="False">
<Columns>
<asp:BoundColum n DataField="Gran tor" ReadOnly="True"
HeaderText="Gra ntor"></asp:BoundColumn >
<asp:BoundColum n DataField="Gran tee" ReadOnly="True"
HeaderText="Gra ntee"></asp:BoundColumn >
<asp:BoundColum n DataField="Obje ct_Type" ReadOnly="True"
HeaderText="Obj ect Type"></asp:BoundColumn >
<asp:BoundColum n DataField="Obje ct_Name" ReadOnly="True"
HeaderText="Obj ect Name"></asp:BoundColumn >
<asp:BoundColum n DataField="Priv ilege_Type" ReadOnly="True"
HeaderText="Pri vilege"></asp:BoundColumn >
<asp:ButtonColu mn Text="Delete" ButtonType="Pus hButton"
CommandName="De lete"></asp:ButtonColum n>
</Columns>

C# code bits
private void InitializeCompo nent()
{
this.dgPrivs.De leteCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);
this.Load += new System.EventHan dler(this.Page_ Load);
}
private void dgPrivs_DeleteC ommand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
string t ="ldsld";
t = t + "Resotr";
}
Do I need to add something else in here anywhere?
Is there anything else I should be looking for?

Thanks
Jeff


Feb 4 '06 #4
I suppose you must have following code:

datagrid.DataSo urce = dataObject;
datagrid.DataBi nd();

Generally, the code is in Page_Load event like
if(!this.IsPost back)
{
datagrid.DataSo urce = dataObject;
datagrid.DataBi nd();
}

Now you comment out IsPostback condition, to see waht happens.

Elton

"Jeff User" wrote:
Elton
In the properties window for the datagrid, the EnableViewState is set
to true. I searched the entire project for the phrase "viewstate" and
it was not found, so I take it, it is not being changed
programatically .

Every piece of my code that has any references at all to either my
datagrid or the button is listed in my code below. Not sure what you
meant by the "datagrid data-binding function", but if you don't see
something in my code that should be there, could you let me know?

I also tried adding the dgPrivs_ItemCom mand event to my C# code, but
that also does not fire when button is clicked.

Thanks again
Jeff


On Sat, 4 Feb 2006 13:30:19 -0800, "Elton W"
<El****@discuss ions.microsoft. com> wrote:
Hi Jeff,

Most common reason to cause datagrid events not being properly fired is that
datagrid’s EnableViewState to be disabled (sometimes indirectly, e.g. its
disabled viewstate in container, page, usercontrol, and so on). Hence, please
check the property first.

And sometimes, some other reasons also cause this kind of problem.
Yesterday, I found one developer’s datagrid data-binding function in wrong
place. In that case, if we don’t read whole code, we can never find out
what’s wrong.
HTH

Elton Wang
"Jeff User" wrote:
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
properties page.
Then, I switched to the lightening bolt (events) and double clicked
the
"DeleteComm and" entry. On the C# page this created the :
private void dgPrivs_DeleteC ommand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{ etc....}
event procedure. It also apparently created the
initialize component entry:
this.dgPrivs.De leteCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);

Clicking the Delete button on the pages causes it to post back, but
this event code never runs.

aspx page bit:
.......
<asp:datagrid id="dgPrivs" style="Z-INDEX: 110; LEFT: 256px; POSITION:
absolute; TOP: 176px" runat="server"
BackColor="#E0E 0E4" BorderStyle="Ou tset" AutoGenerateCol umns="False">
<Columns>
<asp:BoundColum n DataField="Gran tor" ReadOnly="True"
HeaderText="Gra ntor"></asp:BoundColumn >
<asp:BoundColum n DataField="Gran tee" ReadOnly="True"
HeaderText="Gra ntee"></asp:BoundColumn >
<asp:BoundColum n DataField="Obje ct_Type" ReadOnly="True"
HeaderText="Obj ect Type"></asp:BoundColumn >
<asp:BoundColum n DataField="Obje ct_Name" ReadOnly="True"
HeaderText="Obj ect Name"></asp:BoundColumn >
<asp:BoundColum n DataField="Priv ilege_Type" ReadOnly="True"
HeaderText="Pri vilege"></asp:BoundColumn >
<asp:ButtonColu mn Text="Delete" ButtonType="Pus hButton"
CommandName="De lete"></asp:ButtonColum n>
</Columns>

C# code bits
private void InitializeCompo nent()
{
this.dgPrivs.De leteCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);
this.Load += new System.EventHan dler(this.Page_ Load);
}
private void dgPrivs_DeleteC ommand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
string t ="ldsld";
t = t + "Resotr";
}
Do I need to add something else in here anywhere?
Is there anything else I should be looking for?

Thanks
Jeff


Feb 4 '06 #5
Sorry, yes, I do have those two lines and they work fine.

It appears to me that the C# page knows nothing about the aspx
DataGrid event. I think I will create a new post, worded differently,
asking about the connection between aspx control events and C# code
behind pages.

If you have any other ideas, or would like to see all the code posted,
Please let me know.
I have to run out for awhile, will be back at this later.

Thanks again
jeff
On Sat, 4 Feb 2006 15:33:57 -0800, "Elton W"
<El****@discuss ions.microsoft. com> wrote:
I suppose you must have following code:

datagrid.DataS ource = dataObject;
datagrid.DataB ind();

Generally, the code is in Page_Load event like
if(!this.IsPos tback)
{
datagrid.DataS ource = dataObject;
datagrid.DataB ind();
}

Now you comment out IsPostback condition, to see waht happens.

Elton

"Jeff User" wrote:
Elton
In the properties window for the datagrid, the EnableViewState is set
to true. I searched the entire project for the phrase "viewstate" and
it was not found, so I take it, it is not being changed
programatically .

Every piece of my code that has any references at all to either my
datagrid or the button is listed in my code below. Not sure what you
meant by the "datagrid data-binding function", but if you don't see
something in my code that should be there, could you let me know?

I also tried adding the dgPrivs_ItemCom mand event to my C# code, but
that also does not fire when button is clicked.

Thanks again
Jeff


On Sat, 4 Feb 2006 13:30:19 -0800, "Elton W"
<El****@discuss ions.microsoft. com> wrote:
>Hi Jeff,
>
>Most common reason to cause datagrid events not being properly fired is that
>datagrid’s EnableViewState to be disabled (sometimes indirectly, e.g. its
>disabled viewstate in container, page, usercontrol, and so on). Hence, please
>check the property first.
>
>And sometimes, some other reasons also cause this kind of problem.
>Yesterday, I found one developer’s datagrid data-binding function in wrong
>place. In that case, if we don’t read whole code, we can never find out
>what’s wrong.
>
>
>HTH
>
>Elton Wang
>
>
>"Jeff User" wrote:
>
>> 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
>> properties page.
>> Then, I switched to the lightening bolt (events) and double clicked
>> the
>> "DeleteComm and" entry. On the C# page this created the :
>> private void dgPrivs_DeleteC ommand(object source,
>> System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
>> { etc....}
>> event procedure. It also apparently created the
>> initialize component entry:
>> this.dgPrivs.De leteCommand += new
>> System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);
>>
>> Clicking the Delete button on the pages causes it to post back, but
>> this event code never runs.
>>
>> aspx page bit:
>> .......
>> <asp:datagrid id="dgPrivs" style="Z-INDEX: 110; LEFT: 256px; POSITION:
>> absolute; TOP: 176px" runat="server"
>> BackColor="#E0E 0E4" BorderStyle="Ou tset" AutoGenerateCol umns="False">
>> <Columns>
>> <asp:BoundColum n DataField="Gran tor" ReadOnly="True"
>> HeaderText="Gra ntor"></asp:BoundColumn >
>> <asp:BoundColum n DataField="Gran tee" ReadOnly="True"
>> HeaderText="Gra ntee"></asp:BoundColumn >
>> <asp:BoundColum n DataField="Obje ct_Type" ReadOnly="True"
>> HeaderText="Obj ect Type"></asp:BoundColumn >
>> <asp:BoundColum n DataField="Obje ct_Name" ReadOnly="True"
>> HeaderText="Obj ect Name"></asp:BoundColumn >
>> <asp:BoundColum n DataField="Priv ilege_Type" ReadOnly="True"
>> HeaderText="Pri vilege"></asp:BoundColumn >
>> <asp:ButtonColu mn Text="Delete" ButtonType="Pus hButton"
>> CommandName="De lete"></asp:ButtonColum n>
>> </Columns>
>>
>> C# code bits
>> private void InitializeCompo nent()
>> {
>> this.dgPrivs.De leteCommand += new
>> System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gPrivs_DeleteCo mmand);
>> this.Load += new System.EventHan dler(this.Page_ Load);
>> }
>>
>>
>> private void dgPrivs_DeleteC ommand(object source,
>> System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
>> {
>> string t ="ldsld";
>> t = t + "Resotr";
>> }
>>
>>
>> Do I need to add something else in here anywhere?
>> Is there anything else I should be looking for?
>>
>> Thanks
>> Jeff
>>



Feb 5 '06 #6

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

Similar topics

3
2783
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
6
4633
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.
4
3024
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...
3
1318
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.
2
3795
by: Andy Sutorius via DotNetMonster.com | last post by:
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="False" Font-Names="verdana" BorderColor="#CCCC99" BackColor="#CCCC99"...
1
1441
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
0
1791
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...
10
2954
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
2
1795
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"
0
7939
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
8432
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...
1
8078
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,...
0
8299
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...
0
6753
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, 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...
0
5456
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();...
1
2442
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
1
1548
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1285
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.