C
Charles
Hello,
I have found lots of examples and information on how to create an edit
button in the datalist control, however the edit button is done with the edit
template property.
I have created the edit button in a class that Implements ITemplate in the
InstantiateIn Sub. The information of the row that the edit button is
clicked on will be displayed in textboxes (outside of the datalist control)
after postback for editing. Below is some partial code:
Public Class CWebExpenses
Inherits System.Web.UI.Page
dlstExpenses.ItemTemplate = New ItemTemplateClass
Private Class ItemTemplateClass
Implements ITemplate
Public Sub InstantiateIn(ByVal container As
System.Web.UI.Control) Implements System.Web.UI.ITemplate.InstantiateIn
'code that sets up table and other cells
td = New TableCell
Dim _btnEdit As New Button
_btnEdit.Text = "Edit"
AddHandler _btnEdit.Click, AddressOf Edit_Click
td.Controls.Add(_btnEdit)
tr.Cells.Add(td)
End Sub
Private Sub Edit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'What should go in here? I have an HtmlInputHidden in each row
'that I would like to grab to fill in the textboxes that are
outside the datalist
'control.
End Sub
End Class
End Class
Thank you for any help that you can give!
Charles
I have found lots of examples and information on how to create an edit
button in the datalist control, however the edit button is done with the edit
template property.
I have created the edit button in a class that Implements ITemplate in the
InstantiateIn Sub. The information of the row that the edit button is
clicked on will be displayed in textboxes (outside of the datalist control)
after postback for editing. Below is some partial code:
Public Class CWebExpenses
Inherits System.Web.UI.Page
dlstExpenses.ItemTemplate = New ItemTemplateClass
Private Class ItemTemplateClass
Implements ITemplate
Public Sub InstantiateIn(ByVal container As
System.Web.UI.Control) Implements System.Web.UI.ITemplate.InstantiateIn
'code that sets up table and other cells
td = New TableCell
Dim _btnEdit As New Button
_btnEdit.Text = "Edit"
AddHandler _btnEdit.Click, AddressOf Edit_Click
td.Controls.Add(_btnEdit)
tr.Cells.Add(td)
End Sub
Private Sub Edit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'What should go in here? I have an HtmlInputHidden in each row
'that I would like to grab to fill in the textboxes that are
outside the datalist
'control.
End Sub
End Class
End Class
Thank you for any help that you can give!
Charles