I found a problem,UltraWebGrid's child table can't achieve by user-defined column. Why? When I set AutoGenerateColumns is true, UltraWebGrid's child table can display. Below is my C# code:
protected void uwgLight_DataBinding(object sender, EventArgs e) { DataSet ds = Class_LightShelf.GetAll(0); ds.Tables[0].TableName = "LightShelf"; ds.Tables[1].TableName = "LightSeat";
ds.Relations.Add("LightRelations", ds.Tables["LightShelf"].Columns["ID"], ds.Tables["LightSeat"].Columns["LSID"]);
this.uwgLight.DataSource = ds; }
protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { this.uwtLight.DataBind(); } }
Hello,
Most probably this is a page lifecycle issue. At the point where the grid needs information for the child band, this information is not available. My suggestion is moving the code the does that to the InitializeLayout event of the grid (instead of DataBinding). You can also try rebinding the grid in OnInit instead of Load and/or try using the InitializeDataSource event of the grid for that.
Hope this helps.
Thanks. But I still can't understand how can I do. Can you write me a sample code for C# in VS2005?
Just move the data-binding initializing code from Page_Load to the grid InitializeDataSource event, this should do the trick.
if(!IsPostBack) { this.uwtLight.DataBind(); }