Hi,
I'm using the latest version of the Telerik controls and using the RadGrid to show a list of quotations. Dependent on the quote status I want to show/hide linkbuttons for each row depending on which is valid at the time. I have the following columns:
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="View" Text="View Quote" UniqueName="lnkView" />
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Edit" Text="Edit Quote" UniqueName="EditColumn" />
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="BuyNow" Text="Buy Now" UniqueName="BuyNowColumn" />
in the code behind I'm using grdCarQuotes_ItemCreated and grdCarQuotes_ItemDataBound to try and find the linkbutton controls to set their visibility as so:
protected void grdCarQuotes_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
{
// Get car quote status
string status = ((BLL.DTO.QuoteSummaryRow)e.Item.DataItem).Status;
LinkButton lnk = e.Item.FindControl("lnkView") as LinkButton;
if(status != "Quoted")
lnk.Visible = false;
}
}
However, it can't find the control. Please can you advise me on how to best achieve this simple requirement?
TIA,
Rick
I'm using the latest version of the Telerik controls and using the RadGrid to show a list of quotations. Dependent on the quote status I want to show/hide linkbuttons for each row depending on which is valid at the time. I have the following columns:
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="View" Text="View Quote" UniqueName="lnkView" />
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Edit" Text="Edit Quote" UniqueName="EditColumn" />
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="BuyNow" Text="Buy Now" UniqueName="BuyNowColumn" />
in the code behind I'm using grdCarQuotes_ItemCreated and grdCarQuotes_ItemDataBound to try and find the linkbutton controls to set their visibility as so:
protected void grdCarQuotes_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
{
// Get car quote status
string status = ((BLL.DTO.QuoteSummaryRow)e.Item.DataItem).Status;
LinkButton lnk = e.Item.FindControl("lnkView") as LinkButton;
if(status != "Quoted")
lnk.Visible = false;
}
}
However, it can't find the control. Please can you advise me on how to best achieve this simple requirement?
TIA,
Rick