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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -