Domanda

I created a simple gridview, using Telerik RadControls, that is pulling data from a sql database that will act as a contact list. The three columns are Product, Focal and Email.

What I need is to use the hyperlink column to take the emails in the EMAIL column and display them as links create a new email and the also a hyperlink column to have all the names be links to an internal social media.

The email column is easy to figure out since nothing really needs to change but the name column is causing a problem. The social media column will be the same web address with different profile ID's at the end...so for example:

www.UsersSocialTest.com/453654 (but instead of the same id at the end each of the users has a custom ID for each user)

Here is an example of my gridview:

enter image description here

È stato utile?

Soluzione

the best way is to have an extra column in your table in database for saving the address of that social media URL and after that in design mode from your grid view choose edit columns and add a new column with template field type and give it a HeaderText such as "Social Media Link"... now choose edit template from your grid view and find your social media link in it...now from toolbox add a hyperlink to it and in it's editdatabind choose NavigateURL and set a data to it Like Eval("YOUR COLUMN NAME IN DATA BASE")

Altri suggerimenti

you can use a template column as shown below:

<telerik:GridTemplateColumn UniqueName="TemplateColumn">
    <HeaderTemplate>
      Email address
    </HeaderTemplate>
    <ItemTemplate>
    <a href="'mailto:" <%# Eval("EmailColumn") %> "'">  <%# Eval("EmailColumn") %>  </a>
    </ItemTemplate>
 </telerik:GridTemplateColumn>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top