Help: problem extending DataGrid
Hi All, I have some problem when trying to extend my own class from DataGrid. I want to add some more buttons (e.g. an "Add Item" LinkButton, an ImageButton to toggle PageSize, and so on). I have no problem writing a composite server control; however when I try to extend DataGrid, the new child controls are not actually added onto the DataGrid.
Suppose using INamingContainer, when I specify a child control's ID (let's say "AddLink", and add it into the control tree using Controls.Add(childControl), the child control's UniqueID will become sth like "UserControl1.DataGrid1.AddLink", which shows the hierarchy. However, when I try to extend the DataGrid, even with INamingContainer, the child control's ID won't have the UniqueID showing the hierarchy; it stays the same as the ID, no DataGrid's own UniqueID embedded. As a result, I cannnot postback data by using UniqueID.
Anybody knows why this happens? Thanks a lot!
|