8 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 24 Dec 2012, 05:35 AM
Hi,
I suppose you want to hide the column if its value is 0. Try the following code to achieve your scenario.
C#:
Thanks,
Princy.
I suppose you want to hide the column if its value is 0. Try the following code to achieve your scenario.
C#:
protected
void
RadTreeList1_ItemDataBound(
object
sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e)
{
if
(e.Item
is
TreeListDataItem)
{
TreeListDataItem item = (TreeListDataItem)e.Item;
if
(item[
"UniqueName"
].Text ==
"0"
)
{
RadTreeList1.GetColumn(
"UniqueName"
).Display =
false
;
}
}
}
Thanks,
Princy.
0
0

Princy
Top achievements
Rank 2
answered on 26 Dec 2012, 09:12 AM
Hi,
Unfortunately I cannot replicate the issue at my end. Here is the code that I tried in the version 2012.3.1016.35 which worked as expected.
aspx:
C#:
Thanks,
Princy.
Unfortunately I cannot replicate the issue at my end. Here is the code that I tried in the version 2012.3.1016.35 which worked as expected.
aspx:
<
telerik:RadTreeList
runat
=
"server"
ID
=
"RadTreeList1"
DataSourceID
=
"SqlDataSource1"
AutoGenerateColumns
=
"false"
DataKeyNames
=
"ID"
ParentDataKeyNames
=
"ReportsTo"
onitemdatabound
=
"RadTreeList1_ItemDataBound"
>
<
Columns
>
<
telerik:TreeListBoundColumn
DataField
=
"ID"
HeaderText
=
"ID"
UniqueName
=
"ID"
</telerik:TreeListBoundColumn>
</
Columns
>
</
telerik:RadTreeList
>
protected
void
RadTreeList1_ItemDataBound(
object
sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e)
{
if
(e.Item
is
TreeListDataItem)
{
TreeListDataItem item = (TreeListDataItem)e.Item;
if
(item[
"ID"
].Text ==
"0"
)
{
RadTreeList1.GetColumn("ID).Display =
false
;
}
}
}
Thanks,
Princy.
0
Hi Mohamed,
The Display property is not supported for the whole column. You could however set it to all the items of the column using such approach:
All the best,
Vasil
the Telerik team
The Display property is not supported for the whole column. You could however set it to all the items of the column using such approach:
if
(item[
"quantity"
].Text ==
"0"
)
{
(item[
"quantity"
].Style.Add(HtmlTextWriterStyle.Display,
"none"
);
}
All the best,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
0
Accepted

Princy
Top achievements
Rank 2
answered on 27 Dec 2012, 07:39 AM
Hi,
Try modifying the code as shown below.
C#:
Thanks,
Princy.
Try modifying the code as shown below.
C#:
if
(item[
"Quantity"
].Text ==
"0"
)
{
item[
"Quantity"
].Style.Add(HtmlTextWriterStyle.Display,
"none"
);
}
Thanks,
Princy.
0
0
Accepted
Hello Mohamed,
This is the expected behaviour. If you want the text itself to have Display=false, and the cell to be visible. Then you have to add Label element inside the cell, and remove the original text. Then set the required style to the Label element.
All the best,
Vasil
the Telerik team
This is the expected behaviour. If you want the text itself to have Display=false, and the cell to be visible. Then you have to add Label element inside the cell, and remove the original text. Then set the required style to the Label element.
All the best,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.