Hi Guys,
First time poster and relatively new to Telerik controls, especially the RadGrid! I've been searching for a solution to my problem but as yet have not been able to find one so hopefully someone can help me.
I have a RadGrid which displays form entry submissions and then the data entered for each submission within a detail table. It's all working fine, but being a UI guy I want to alter the Colspan of the table cell in which the detail table sits to one less so there is an equal indentation at either side. I was able to find out how to do this and have used the code below to do so:
However, now I have a problem where for certain criteria I need to hide certain columns of the grid and when doing so, the colspan is now incorrect and is not taking in to account just the VISIBLE columns. See the attached images to see what I mean.
Here is the code I use to hide the columns:
I appreciate that this may or may not be the best way to do this.
Any help is much appreciated.
Rob.
First time poster and relatively new to Telerik controls, especially the RadGrid! I've been searching for a solution to my problem but as yet have not been able to find one so hopefully someone can help me.
I have a RadGrid which displays form entry submissions and then the data entered for each submission within a detail table. It's all working fine, but being a UI guy I want to alter the Colspan of the table cell in which the detail table sits to one less so there is an equal indentation at either side. I was able to find out how to do this and have used the code below to do so:
protected
void
gdSubmissions_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridNestedViewItem)
{
GridNestedViewItem item = e.Item
as
GridNestedViewItem;
int
newColSpanValue = item.NestedViewCell.ColumnSpan -1;
item.NestedViewCell.Attributes[
"colspan"
] = newColSpanValue.ToString();
item.NestedViewCell.Style.Add(
"padding"
,
"5px"
);
item.NestedViewCell.Style.Add(
"border-bottom"
,
"1px solid #e8e8e8"
);
}
}
However, now I have a problem where for certain criteria I need to hide certain columns of the grid and when doing so, the colspan is now incorrect and is not taking in to account just the VISIBLE columns. See the attached images to see what I mean.
Here is the code I use to hide the columns:
protected
void
gdSubmissions_PreRender(
object
sender, EventArgs e)
{
RemoveExpandIconWhenNoRecords(gdSubmissions.MasterTableView);
// Hide Columns
if
(usesApproval)
{
gdSubmissions.MasterTableView.GetColumn(
"Resubmit"
).Visible = (_submissionStatus == -1);
gdSubmissions.MasterTableView.GetColumn(
"Approve"
).Visible = (_submissionStatus == 0);
gdSubmissions.MasterTableView.GetColumn(
"Reject"
).Visible = (_submissionStatus == 0);
}
}
I appreciate that this may or may not be the best way to do this.
Any help is much appreciated.
Rob.