ASP.NET variable inside hyperlink / URL string -
i'm trying modify bvcommerce order manager link item that's listed our staff members can fill orders easier clicking on link, taking them item page instead of having manually search it.
i wrapped asp:hyperlink around original asp:label code so:
<asp:templatefield headertext="sku"> <itemtemplate> <asp:hyperlink navigateurl='/product/skufieldhere.aspx' runat="server"><asp:label id="skufield" runat="server"></asp:label></asp:hyperlink> </itemtemplate> </asp:templatefield>
now, problem need skufield gets populated label in between '/product/' , '.aspx'
i'm not familiar asp.net enough know how so, , many attempts @ using <% %> , such have failed.
i've looked @ behind, seen below:
dim skufield label = e.row.findcontrol("skufield") if skufield isnot nothing skufield.text = lineitem.productsku end if
so please advise me how minimally possible, preferably without modifying behind.
thank much!
edit: seen in comments below, i've tried adding:
dim skulink hyperlink = e.row.findcontrol("skulink") if skulink isnot nothing skulink.navigateurl = "products"+lineitem.productsku+".aspx" end if
in behind, , replaced navigateurl="skulink" url ~/skulink
fixed issue. solution code in behind , call id in front. final working code needs reference in future:
<asp:templatefield headertext="sku"> <itemtemplate> <asp:hyperlink id="skulink" runat="server"><asp:label id="skufield" runat="server"></asp:label></asp:hyperlink> </itemtemplate> </asp:templatefield>
behind:
dim skufield label = e.row.findcontrol("skufield") if skufield isnot nothing skufield.text = lineitem.productsku end if dim skulink hyperlink = e.row.findcontrol("skulink") if skulink isnot nothing skulink.navigateurl = "~/product/"+lineitem.productsku+".aspx" end if
Comments
Post a Comment