Hi
I want to do below task using Repeater ItemDataBound
Code
' target='_blank'>View Word MeaningThanks
Hi
I want to do below task using Repeater ItemDataBound
' target='_blank'>View Word MeaningThanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Naimish MakwanaRank #324 · 7.7K reputationPosted Jun 11, 2023, 9:46 AM EDT
try below:
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { // Find the LinkButton control LinkButton lnkBook = (LinkButton)e.Item.FindControl("lnkBook"); // Get the SessionPlanID value from the current item's data object DataRowView rowView = (DataRowView)e.Item.DataItem; int sessionPlanID = Convert.ToInt32(rowView["SessionPlanID"]); // Encrypt the SessionPlanID value string encryptedSessionPlanID = AES.Encrypt(sessionPlanID.ToString()); // Set the hyperlink's href attribute with the encrypted query string value lnkBook.Attributes["href"] = $"../Docs/WordMeaningContent?spid={encryptedSessionPlanID}"; // Set the target attribute to '_blank' lnkBook.Attributes["target"] = "_blank"; } }Thanks