Guest User

Untitled

a guest
Aug 17th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. Convert this c# to vb.net [closed]
  2. protected void dGrid_PreRender(object sender, EventArgs e)
  3. {
  4. try
  5. {
  6. DataGrid dgSidDetails = (DataGrid)sender;
  7. //Fix for numbering being in a left aligned column
  8. //For some reason, the ColumnSpan property is ignored andnot rendered
  9. //unless set using the Attributes
  10. if (dgSidDetails.AllowPaging == true && dgSidDetails.AutoGenerateColumns == false)
  11. {
  12. //Get the Table
  13. System.Web.UI.WebControls.Table tab =
  14. (System.Web.UI.WebControls.Table)dgSidDetails.Controls[0];
  15.  
  16. if (dgSidDetails.PagerStyle.Position == PagerPosition.Top ||
  17. dgSidDetails.PagerStyle.Position == PagerPosition.TopAndBottom)
  18. {
  19. tab.Rows[0].Cells[0].Attributes.Add("colspan",
  20. tab.Rows[1].Cells.Count.ToString());
  21. }
  22. }
  23. }
  24. catch (Exception ex)
  25. {
  26.  
  27. }
  28. }
  29.  
  30. Protected Sub dGrid_PreRender(ByVal sender As Object, ByVal e As EventArgs)
  31. Try
  32. Dim dgSidDetails As DataGrid = CType(sender,DataGrid)
  33. //'Fix for numbering being in a left aligned column
  34. //'For some reason, the ColumnSpan property is ignored andnot rendered
  35. //'unless set using the Attributes
  36. If ((dgSidDetails.AllowPaging = true) _
  37. AndAlso (dgSidDetails.AutoGenerateColumns = false)) Then
  38. // 'Get the Table
  39. Dim tab As System.Web.UI.WebControls.Table = CType(dgSidDetails.Controls(0),System.Web.UI.WebControls.Table)
  40. If ((dgSidDetails.PagerStyle.Position = PagerPosition.Top) _
  41. OrElse (dgSidDetails.PagerStyle.Position = PagerPosition.TopAndBottom)) Then
  42. tab.Rows(0).Cells(0).Attributes.Add("colspan", tab.Rows(1).Cells.Count.ToString)
  43. End If
  44. End If
  45. Catch ex As Exception
  46.  
  47. End Try
  48. End Sub
Add Comment
Please, Sign In to add comment