Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating an event handler for a button inside a datgrid

Status
Not open for further replies.

ac11nyc

Programmer
Joined
Oct 1, 2003
Messages
94
Location
US
can someone please tell me why this isnt working??

Public Sub GenerateTasksDG(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
If ((e.Item.ItemType = ListItemType.Item) Or (e.Item.ItemType = ListItemType.AlternatingItem)) Then

Dim TasksDG As DataGrid = New DataGrid

Dim btnc As ButtonColumn = New ButtonColumn
btnc.HeaderText = "Save Hours"
btnc.ButtonType = ButtonColumnType.PushButton
btnc.Text = "Save"
btnc.CommandName = "Save"
TasksDG.Columns.Add(btnc)

AddHandler TasksDG.ItemCommand, AddressOf Grid_ItemCommand

Dim _tasks As DataView = ds.Tables ("HoursWorked").DefaultView
_tasks.RowFilter = "ProjectId='" + e.Item.Cells(0).Text + "'"

TasksDG.DataSource = _tasks
TasksDG.DataBind()

e.Item.Cells(2).Controls.Add(TasksDG)

End Sub


Protected Sub Grid_ItemCommand(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
If (e.CommandName = "Save") Then
Response.Redirect("ITGMainMenu.aspx")
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top