Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Dynamic Datagrid Creation - ItemCommand event not firing

Reply
Thread Tools

Dynamic Datagrid Creation - ItemCommand event not firing

 
 
PD
Guest
Posts: n/a
 
      10-23-2003
I am generating a dynamic datagrid that gets assigned to a cell within
the parent grid. Here's the html:

<aspataGrid id="dgPositions" runat="server" Width="710"
CellPadding="3" HeaderStyle-Font-Bold="True" CssClass="inputfields"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn></asp:TemplateColumn>
</Columns>
</aspataGrid>

I have a custom control within the child grid that inherits from the
ImageButton control:

With cb
.ToolTip = "Remove"
.CausesValidation = False
.ImageUrl = "images/delete_s1.gif"
.Message = "Are you sure you want to delete
this?"
.ID = "btnRemove"
.AlternateText = "Remove"
.CommandName = "Delete"
End With
container.Controls.Add(cb)

The child grid is constructed within the dgPositions_ItemDataBound
function of the parent grid.

dgNewGrid.HeaderStyle.Font.Bold = True
dgNewGrid.CellPadding = 3
dgNewGrid.CssClass = "inputfields"
dgNewGrid.AutoGenerateColumns = False
dgNewGrid.ID = "gridPositions"
AddHandler dgNewGrid.ItemCommand, AddressOf
dgPositions_ItemCommand2
dgi.Cells(0).Controls.Add(dgNewGrid)


I want the dgPositions_ItemCommand2 to kick off when the user clicks
on the custom control (cb) above. The code to
dgPositions_ItemCommand2:

Public Sub dgPositions_ItemCommand2(ByVal sender As Object, ByVal
e As System.Web.UI.WebControls.DataGridCommandEventArgs )
Try
If e.CommandName = "Delete" Then
Response.Write("Test")
End If
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub

I have not been successful in getting the dgPositions_ItemCommand2
code to kick off. Any thoughts/suggestions would be greatly
appreciated!!

Thanks,
Patrick
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ItemCommand event not firing from a dynamic user control,feeling puzzled EvelynAnd Ethan ASP .Net 4 01-09-2006 03:12 AM
DataGrid ItemCommand event not firing if not first page =?Utf-8?B?ZGFuYw==?= ASP .Net 3 10-26-2005 05:24 PM
ItemCommand event not firing from a dynamic user control,feeling puzzled EvelynAnd Ethan ASP .Net 0 10-17-2005 04:00 AM
ItemCommand event not firing from a dynamic user control,feeling puzzled EvelynAnd Ethan ASP .Net 0 10-17-2005 04:00 AM
Datagrid ItemCommand Event Not Firing =?Utf-8?B?RGVlcGVzaA==?= ASP .Net 2 10-06-2005 12:46 AM



Advertisments