datagrid|创建|链接|响应
本例用代码实现了创建DataGrid并响应了CheckBox事件,并实现了超链接列的多变量传送。
创建一个前台页面
CreateDataGrid.aspx:
在Form中添加一个PlcaeHolder,ID为"ph",Runat="Server"
后台页面
CreateDatagrid.aspx.cs
public class CreateDataGrid : System.Web.UI.Page
{
public String sql = "Select FirstName,LastName,HomePhone,Title FROM Employees";
public DataGrid mygrid = new DataGrid();
protected System.Web.UI.WebControls.PlaceHolder ph;
public String SortExpression;
private void Page_Load(object sender, System.EventArgs e)
{
//CreateDataGridForm.Controls.Add(MakeGrid());
this.ph.Controls.Add(MakeGrid());
}
// protected override void CreateChildControls()
// {
//base.CreateChildControls ();
/