Hello.. I've got problem in passing query string(unique id) to hyperlink. This hyperlink will be send as an email body for a specific recipient. The button click is function to send email that contain the hyperlink. To be more specific, the button is place inside grid view where have its own unique id and data for every row. Mean that every row in grid view will have its own send button. So when user click on the send button it will send the hyperlink that have unique id for specific row. When recipient click on the hyperlink, it will open a page that will view the data of a unique id. I hope you guys understand what I'm trying to say because I'm dying looking for an answer as I have make research on internet for a whole day and it still not solve. Please help.
What I have tried:
<asp:Button ID="sendbtn" runat="server" CommandName="Select" Text="send" />
private void SendEmail(string uniqueid)
{
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
GridView2.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
//uniqueid = GenerateRandom.GetUniqueReferalid(14);
//string cid = "tripid";
//string url = "
View Transaction";
MailMessage mm = new MailMessage("adaniys93@gmail.com", "adaniys93@gmail.com");
mm.Subject = "GridView Email";
mm.Body = "<a href='http://localhost/businesstrip/PrintBusinessTrip.aspx?tripid=" + Request.QueryString["tripid"].ToString() + " > login";
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = "addaniys93@gmail.com";
NetworkCred.Password = "0";
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
}
}
}