Hello,
My customer has requested that we put link buttons into a specific field on a grid. The nature of the filed being that I need to have regular text followed by an unlimited number links means that I have to add my buttons dynamically. I have the text followed by links working proper upon the initial page load but something happens after the grid filter is applied. Once the grid filter is applied a post back occurs my method is still called to reformat the filed into it's final format however. Once the page loads the links are nowhere to be found and the grid cells display the text that is being converted into the buttons. Currently I am calling my logic to create the grid links on page load. I have to create the grid links in load because if I do it any later than that then my link buttons no longer function properly. Some help would be greatly appreciated. Thanks in advance below are some of my code snippets.
-Brandon
RadGrid Load Method
1.Private Sub RadGridResults_Load(sender As Object, e As EventArgs) Handles RadGridResults.Load2. For Each Item As GridItem In RadGridResults.MasterTableView.Items3. CreateGridLinks(Item)4. Next5.End SubCreate Grid Links Method (Simplified From Original)
01.Private Sub CreateGridLinks(item As GridItem)02. If TypeOf item Is Telerik.Web.UI.GridDataItem Then03. Dim dataItem As Telerik.Web.UI.GridDataItem = CType(item, Telerik.Web.UI.GridDataItem)04. For Each cell As TableCell In item.Cells05. Dim Issues() As String = cell.Text.Split(";"c)06. If Issues.Length > 1 AndAlso cell.Text <> " " Then07. Dim CellText As String = Issues(0) + " "08. Dim CellId As String = ""09. Dim IssueAppealType As String = ""10. Dim IssueAppealId As String = ""11. For i As Integer = 1 To _issues.Length - 112. If i = 1 Then13. cell.Controls.Add(New LiteralControl(CellText))14. End If15. If _issues(i).Trim.Split(":"c).Length > 1 Then16. Dim IssueAppealButton As New LinkButton()17. CellId = _issues(i).Trim.Replace(":", "")18. 19. Dim IssueAppealArray = _issues(i).Trim.Split(":"c)20. IssueAppealType = IssueAppealArray(0)21. IssueAppealId = IssueAppealArray(1)22. IssueAppealButton.Text = IssueAppealId23. cntrlCount += 124. IssueAppealButton.ID = "LinkButton" + CellId + cntrlCount.ToString25. 26. AddHandler IssueAppealButton.Click, Sub(send, evt) HandleIssueLinkClick(IssueAppealId, IssueAppealType)27. 28. cell.Controls.Add(IssueAppealButton)29. cell.Controls.Add(New LiteralControl(" "))30. End If31. Next32. 33. End If34. Next35. End If36.End Sub