'add the link button to the table
Dim LinkButtonEdit As New LinkButton
LinkButtonEdit.ID = "LinkButtonEdit" + row_data.ID.ToString
LinkButtonEdit.Text = "Edit"
cell.Controls.Add(LinkButtonEdit)
'Add handler
AddHandler LinkButtonEdit.Click, AddressOf EditRevenues
'This is my sub EditRevenues:
Dim lnk As LinkButton
lnk = CType(sender, LinkButton)
Dim EmpID As Integer = CInt(lnk.ID.Replace("LinkButtonEdit", "")) 'this gives the link button's emp id
Dim MonthID As Integer
'Add text boxes to the row
For m As Integer = 1 To 12
For i As Integer = 2 To tEmps.Rows.Count + 1
If t.Rows(i).ID = EmpID Then
MonthID = CInt(t.Rows(1).Cells(m).ID.Replace("MonthID", ""))
Dim TextBoxEdit As New TextBox
TextBoxEdit.ID = MonthID.ToString
TextBoxEdit.Width = 30
TextBoxEdit.BackColor = Drawing.Color.LightGray
TextBoxEdit.Text = t.Rows(i).Cells(m).Text.ToString
t.Rows(i).Cells(m).Controls.Add(TextBoxEdit)
End If
Next
Next
'Add save button to the row
For Int As Integer = 2 To tEmps.Rows.Count + 1
If t.Rows(Int).ID = EmpID Then
Dim cell_save As New TableCell
Dim LinkButtonSave As New LinkButton
LinkButtonSave.ID = "LinkButtonSave" + EmpID.ToString
LinkButtonSave.Text = "Save"
cell_save.Controls.Add(LinkButtonSave)
t.Rows(Int).Cells.Add(cell_save)
'Add handler
AddHandler LinkButtonSave.Click, AddressOf SaveRevenues
End If
Next
'This is my sub SaveRevenues:
'implementation here but SaveRevenues doesn't execute
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE