c# - Bind to a hyperlinkfield in a gridview -


i have gridview pulls data xml file. 1 of columns of gridview hyperlinkfield. want bind url field contained in xml file column. think have right idea code below cant figure out how finish it. url datakey of gridview way.

protected void grdcontents_rowcreated(object sender, gridviewroweventargs e) {     ((hyperlinkfield)grdcontents.columns[1]).navigateurl =        } 

you can bind hyperlink on gridview_rowdatabound event this

    protected void gridview_rowdatabound(object sender, gridviewroweventargs e)         {             if (e.row.rowtype.equals(datacontrolrowtype.datarow))             {                 hyperlinkfield lnkhyper = (hyperlinkfield)e.row.findcontrol("hyperlinkfield1");                 lnkhyper.navigateurl="";             }         } 

try this.

or can bind url using databinder.eval @ time of binding source grid like

 <columns>        <asp:templatefield>                                                    <itemtemplate>              <asp:hyperlink runat="server"  navigateurl="<%# databinder.eval(container.dataitem, "url") %>"></asp:hyperlink>          </itemtemplate>         </asp:templatefield> </columns> 

you can use well, providing data source grid view.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -