Ok. This is driving me nuts, because I'm missing what's causing this to happen. I am creating RadGrid columns programmatically, using one grid (aspx page) for 7 different datasources, controlled by a Case statement. My problem is that if I click either on the Edit button( GridEditCommandColumn) or on the Delete button (GridButtonColumn), the Delete button disappears on postback. All other columns(GridBoundColumn) reappear just fine. Here is the snippet of code. It appears in a Page Load event. The DataSourceID is supplied with a NeedDataSource event which is why it is commented out in the snippet. What am I missing? Thanks in advance.
If
Not
IsPostBack
Then
Dim
intReport
As
Integer
= Request(
"Report"
)
Select
intReport
Case
0
' Comments
'rgDisplay.DataSourceID = "CommentsDS"
rgDisplay.MasterTableView.DataKeyNames =
New
String
() {
"CMT_REC_ID"
}
rgDisplay.Width = Unit.Percentage(90)
rgDisplay.PageSize = 5
rgDisplay.AllowPaging =
True
rgDisplay.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
rgDisplay.AutoGenerateColumns =
False
rgDisplay.Skin =
"Hay"
rgDisplay.MasterTableView.PageSize = 20
rgDisplay.MasterTableView.Width = Unit.Percentage(100)
rgDisplay.MasterTableView.EditMode = GridEditMode.InPlace
Dim
colEdit
As
GridEditCommandColumn
colEdit =
New
GridEditCommandColumn
colEdit.UniqueName =
"EditCommandColumn"
colEdit.ItemStyle.Width = Unit.Pixel(25)
rgDisplay.MasterTableView.Columns.Add(colEdit)
Dim
colDel
As
GridButtonColumn
colDel =
New
GridButtonColumn
colDel.Visible =
True
colDel.CommandName =
"Delete"
colDel.UniqueName =
"cmdDelete"
colDel.Text =
"Delete"
colDel.ItemStyle.Width = Unit.Pixel(25)
rgDisplay.MasterTableView.Columns.Add(colDel)
Dim
colBound
As
GridBoundColumn
colBound =
New
GridBoundColumn
rgDisplay.MasterTableView.Columns.Add(colBound)
colBound.DataField =
"CMT_REC_ID"
colBound.HeaderText =
"Number"
colBound.UniqueName =
"CMTRecID"
colBound =
New
GridBoundColumn
rgDisplay.MasterTableView.Columns.Add(colBound)
colBound.DataField =
"CMT_DESCRIPTION"
colBound.HeaderText =
"Description"
colBound.UniqueName =
"CMTDescription"