1
Answer

How to add facebook button for dynamic links in asp.net?

I am making a website in which i am sending 10 links to all users and i am using 10 panels for every add i am sending, every panel has two buttons one to view the add and one to share the add on their facebook profile so i want to know how can i take the url from that href or link button and put assign it on a facebook share button so user can post that link on their facebook timeline, over that all these links will get refreshed randomly every day automatically. So how can i achieve this ?
 
My code--
 
  1. <asp:Panel ID="Panel1" runat="server">  
  2. <table class="table table-striped table-bordered">              
  3.     <tr>  
  4.         <td>Ads 1</td>  
  5.         <td>  
  6.            Link  
  7.         </td>  
  8.         <td>  
  9.               
  10.             <asp:Button ID="Button21" runat="server" OnClick="Button21_Click" Text="View" CssClass="btn btn-primary btn-sm" />  
  11.             <asp:Button ID="Button2" runat="server" Text="Share" CssClass="btn btn-danger btn-sm" />  
  12.   
  13.         </td>  
  14.     </tr>  
  15. </table>  
  16. </asp:Panel>  
 This is my code for creating the panel and setting two buttons in it, i have 9 more panels like this below this code.
 
How can i make this share button ? which takes the href from link button or hyperlink(i am using button click even to redirect the user but i can change it accordingly) and use that url as a share link ?
 
Thanks 

Answers (1)

0
Photo of Carlos Sanchez
NA 264 0 20y
Thank you jshepler. I prefer the first method, cuz is esier and cuz I dont know if the second method is possible in C#. thank you again, I appreciate your help. Regards.
0
Photo of jshepler
NA 63 0 20y
2 ways to do this: 1. Combine the two (or more) columns in your select statement: SELECT IDEmploee, Name + ' ' + LastName + ' ' + SecondLastName AS 'Employee'. You would then have 2 columns: IDEmployee and Employee. 2. Tell the datagrid not to automatically generate the columns - do them manually: Employee <%# DataBinder.Eval(Container.Dataitem, "Name") %> <%# DataBinder.Eval(Container.Dataitem, "LastName") %> <%# DataBinder.Eval(Container.Dataitem, "SecondLastName") %> The first method is the preferred way unless you need to have the columns seperate for something else. Having the database doing the work is much more efficient, not to mention easier to code.