I have several RadGrids on a page which are reading data using a stored procedure.The autogeneratecolumns is set to true.
I am adding some controls to the rows dynamically on ItemDataBound. When I do a Sort/Filter on a RadGrid, that grid is rendering properly, but the other grids are losing the dynamically added controls.
I tried using the advanced databinding using the NeedDataSource and also doing a simple bind on every postback. It fails in both the scenarios.
I am adding some controls to the rows dynamically on ItemDataBound. When I do a Sort/Filter on a RadGrid, that grid is rendering properly, but the other grids are losing the dynamically added controls.
I tried using the advanced databinding using the NeedDataSource and also doing a simple bind on every postback. It fails in both the scenarios.
protected void myRadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; foreach (string hlc in hyperlinksColumns) { HyperLink link = new HyperLink(); Guid guid = new Guid(); link.ID = guid.ToString(); link.Text = item[hlc].Text; //accessing the GridBoundColumn to get the text link.NavigateUrl = item[hlc + "_URL"].Text; item[hlc].Controls.Add(link); } foreach (string ic in imageColumns) { Image image = new Image(); Guid guid = new Guid(); image.ID = guid.ToString(); image.ImageUrl = ImageLocation + item[ic + "_IMG"].Text; item[ic + "_IMG"].Controls.Add(image); } }}