+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Sitefinity URL in RadGrid

Sitefinity URL in RadGrid

2 posts, 0 answered
  1. Geoff
    Geoff avatar
    26 posts
    Registered:
    26 Oct 2010
    24 Jan 2011
    Link to this post
    Hi,
    Is there an example or how do I reference a sitfinity page from a radgrid hyperink field and pass it a parameter from the grid?

    e.g.  http://site/mydetailspage.aspx?parameter=2

    And what would be the best way for a usercontrol on that page to reference the parameter?
    thx
    -geoff
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    26 Jan 2011
    Link to this post
    Hello Geoff,

    You can use GridHyperLinkColum or TemplateColumn

    sample

    <telerik:RadGrid runat="server" ID="RadGrid1" PageSize="20" Skin="Vista"  >
      <SelectedItemStyle BackColor="Aqua" />
       <MasterTableView  AutoGenerateColumns="false" >
       <Columns>
       <telerik:GridHyperLinkColumn HeaderText="PageLink"  Target="_blank"
        UniqueName="HyperlinkColumn">
        </telerik:GridHyperLinkColumn>
       </Columns>
       </MasterTableView>
      </telerik:RadGrid>

    code behind

    protected void Page_Load(object sender, EventArgs e)
       {
           RadGrid1.DataSource = PageSource();
           RadGrid1.ItemDataBound += new GridItemEventHandler(RadGrid1_ItemDataBound);
           RadGrid1.DataBind();
       }
     
       protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
       {
           if (e.Item is GridDataItem)
           {
               GridDataItem dataItem = (GridDataItem)e.Item;
               HyperLink link = (HyperLink)dataItem["HyperlinkColumn"].Controls[0];
               link.NavigateUrl = ((ICmsPage)e.Item.DataItem).StaticUrl;
               link.Text = ((ICmsPage)e.Item.DataItem).Title;
           }
       }
     
       protected IList PageSource()
       {
           var manager = new CmsManager();
           return manager.GetPages();
       }


    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered