c# - Hyperlink in GridView with one column -
i have 1 column in gridview has templatefield
url in it. question in text="details"
instead of details
want p_d_name
in it.
this code:
<asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" datasourceid="sqldatasource1"> <columns> <asp:boundfield datafield="p_d_name" headertext="p_d_name" sortexpression="p_d_name" visible="false" /> <asp:templatefield> <itemtemplate> <asp:hyperlink id="hyperlink1" runat="server" text="details" target="_blank" navigateurl='<%# "myurl" + eval("p_d_name")%>'></asp:hyperlink> </itemtemplate> </asp:templatefield> </columns> </asp:gridview>
you use same type of databinding you're using navigateurl:
<asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" datasourceid="sqldatasource1"> <columns> <asp:boundfield datafield="p_d_name" headertext="p_d_name" sortexpression="p_d_name" visible="false" /> <asp:templatefield> <itemtemplate> <asp:hyperlink id="hyperlink1" runat="server" text='<%# eval("p_d_name")%>' target="_blank" navigateurl='<%# "myurl" + eval("p_d_name")%>'></asp:hyperlink> </itemtemplate> </asp:templatefield> </columns> </asp:gridview>
Comments
Post a Comment