|
Step 1: Make column elements run at server
In Iron Speed Designer design mode, add "runat" and "id" attributes to the <th>
and the <td> elements of the column, as shown in the figure below.
Step 2: Find and hide the elements at server
You only need to add three lines of code to:
1. find the column header and hide it
2. loop through table rows, and
3. find the cell and hide it
C#:
public class EmployeesTableControl : BaseEmployeesTableControl {
public EmployeesTableControl() {
PreRender += new EventHandler(EmployeesTableControl_PreRender);
}
void EmployeesTableControl_PreRender(object sender, EventArgs e) {
FindControl("HireDateHeader").Visible = false;
foreach (EmployeesTableControlRow row in GetRecordControls())
row.FindControl("HireDateCell").Visible = false;
}
}
|
Visual Basic .NET:
Public Class EmployeesTableControl
Inherits BaseEmployeesTableControl
Public Sub New()
AddHandler PreRender, AddressOf EmployeesTableControl_PreRender
End Sub
Sub EmployeesTableControl_PreRender(ByVal sender As Object, ByVal e As EventArgs)
FindControl("HireDateHeader").Visible = False
For Each row As EmployeesTableControlRow In GetRecordControls()
row.FindControl("HireDateCell").Visible = False
Next
End Sub
End Class
|
|