This is a migrated thread and some comments may be shown as answers.

[Solved] format string with a url and multiple items??

1 Answer 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mac
Top achievements
Rank 1
mac asked on 11 Jun 2009, 08:20 PM
hello is it possible to have a Groupbyexpression render as a link? I would like to be able to pass the friendly name to the user and the recordid in the url. something like <a href=# onclick=openRadWindow('1105512'); return false;>2009 Mazda Miata</a>
This is my current group by expression and format string .. however you will note I have used {0} for both instances. 

 

Would LOVE to see : Mazda Miata: Avaialable: 1
RENDERS AS: RecordID: 80329; Available: 1

 

<GroupByExpressions>   
<telerik:GridGroupByExpression> 
<GroupByFields> 
<telerik:GridGroupByField FieldAlias="Description" FieldName="RecordID" /> 
</GroupByFields> 
<SelectFields> 
<telerik:GridGroupByField FieldName="RecordID" FormatString="<a href=# onclick=openRadWindow('{0}'); return false;>{0}</a>" /> 
<telerik:GridGroupByField FieldName="Countitem" Aggregate="Count" HeaderText="Available"/>  
</SelectFields> 
</telerik:GridGroupByExpression> 
</GroupByExpressions> 
 

 

The current string does work to popup the information (I have no idea how without any quotes...) , however I really would prefer to see the description.
thanks
mac

 

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 15 Jun 2009, 03:05 PM
Hi mac,

RadGrid's group header displays only values that have been specified in the SelectFields collection. If you need to replace this text with your custom text, however, you are free to do so in RadGrid's ItemDataBound event:

void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    if (e.Item is GridGroupHeaderItem) 
    { 
        GridGroupHeaderItem item = e.Item as GridGroupHeaderItem; 
        string headerText = item.DataCell.Text; 
    } 

In the above example, the group header text can be accessed and modified as given.

Kind regards,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
mac
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or