Hi there,
I am creating a radgrid dynamically in page load. i have added autogenerated delete column as guided by Princy and is working great. my new issue with that grid is that i am adding two more columns to that radgrid as below(in page load itself).
Dim updateColumn As New GridButtonColumn()
radGdItems.MasterTableView.Columns.Add(updateColumn)
updateColumn.CommandName = "Update"
updateColumn.Text = "Update"
updateColumn.UniqueName = "Update"
updateColumn.Visible = False
boundColumn = New GridBoundColumn()
radGdItems.MasterTableView.Columns.Add(boundColumn)
boundColumn.UniqueName = "WarningIcon"
boundColumn.ItemStyle.Width = Unit.Pixel(25)
boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center
also adding detail table like this
Dim tableViewWarnings As New GridTableView(radGdItems)
tableViewWarnings.Name = "DetalTable1"
radGdItems.MasterTableView.DetailTables.Add(tableViewWarnings)
boundColumn = New GridBoundColumn()
tableViewWarnings.Columns.Add(boundColumn)
boundColumn.DataField = "Warning"
and am managing the visibility of these three items in prerender as follows
For Each dataItem As GridDataItem In radGdItems.MasterTableView.Items
If condition = true Then
radGdItems.AllowMultiRowSelection = True
radGdItems.Columns.FindByUniqueName("Update").Visible = True
dataItem.Selected = True
ExpandColumnVisible = True
dataItem("WarningIcon").Visible = True
dataItem.Item("WarningIcon").Text = "<img src=""../Images/Warning.gif"" />"
Else
dataItem("Update").Text = " "
Dim cell As TableCell = dataItem.Item("ExpandColumn")
cell.Controls().Clear()
dataItem("WarningIcon").Text = " "
End If
Next
I mean, these columns (the warning icon column and expand collapse column) are visible based on a condition.
this grid is in one radtab inside a usercontrol and i have another radtab containing a grid in the parent page. An update in the parent page grid row can set the condition for the column visibility to true.
Suppose,initially the update column, warningIcon column and detail table is not visible for the rows in the dynamically created grid, and when i update a row in the parent page, the condition is set to true,and this entire code works(i mean control flows through this code) setting those columns visible = true. but the initially hidden columns does not become visible. instead the dataItem.Selected = True line only works. that means, the rows, where actually these columns need to be visible become selected, but columns not visible.
i have applied ajax in the parent page grid as
<telerik:AjaxSetting AjaxControlID="radGdVM">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="radGdVM" LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:AjaxUpdatedControl ControlID="UserControl1" />
</UpdatedControls>
</telerik:AjaxSetting>
if i do a complete postback in the page, the columns become visible.
what is wrong with my code and what i need to do to make the columns visible?
Expecting some good advice,
Regards
Veena
I am creating a radgrid dynamically in page load. i have added autogenerated delete column as guided by Princy and is working great. my new issue with that grid is that i am adding two more columns to that radgrid as below(in page load itself).
Dim updateColumn As New GridButtonColumn()
radGdItems.MasterTableView.Columns.Add(updateColumn)
updateColumn.CommandName = "Update"
updateColumn.Text = "Update"
updateColumn.UniqueName = "Update"
updateColumn.Visible = False
boundColumn = New GridBoundColumn()
radGdItems.MasterTableView.Columns.Add(boundColumn)
boundColumn.UniqueName = "WarningIcon"
boundColumn.ItemStyle.Width = Unit.Pixel(25)
boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center
also adding detail table like this
Dim tableViewWarnings As New GridTableView(radGdItems)
tableViewWarnings.Name = "DetalTable1"
radGdItems.MasterTableView.DetailTables.Add(tableViewWarnings)
boundColumn = New GridBoundColumn()
tableViewWarnings.Columns.Add(boundColumn)
boundColumn.DataField = "Warning"
and am managing the visibility of these three items in prerender as follows
For Each dataItem As GridDataItem In radGdItems.MasterTableView.Items
If condition = true Then
radGdItems.AllowMultiRowSelection = True
radGdItems.Columns.FindByUniqueName("Update").Visible = True
dataItem.Selected = True
ExpandColumnVisible = True
dataItem("WarningIcon").Visible = True
dataItem.Item("WarningIcon").Text = "<img src=""../Images/Warning.gif"" />"
Else
dataItem("Update").Text = " "
Dim cell As TableCell = dataItem.Item("ExpandColumn")
cell.Controls().Clear()
dataItem("WarningIcon").Text = " "
End If
Next
I mean, these columns (the warning icon column and expand collapse column) are visible based on a condition.
this grid is in one radtab inside a usercontrol and i have another radtab containing a grid in the parent page. An update in the parent page grid row can set the condition for the column visibility to true.
Suppose,initially the update column, warningIcon column and detail table is not visible for the rows in the dynamically created grid, and when i update a row in the parent page, the condition is set to true,and this entire code works(i mean control flows through this code) setting those columns visible = true. but the initially hidden columns does not become visible. instead the dataItem.Selected = True line only works. that means, the rows, where actually these columns need to be visible become selected, but columns not visible.
i have applied ajax in the parent page grid as
<telerik:AjaxSetting AjaxControlID="radGdVM">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="radGdVM" LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:AjaxUpdatedControl ControlID="UserControl1" />
</UpdatedControls>
</telerik:AjaxSetting>
if i do a complete postback in the page, the columns become visible.
what is wrong with my code and what i need to do to make the columns visible?
Expecting some good advice,
Regards
Veena