c# - Replace HTML content in gridview with Linkbutton -


i want replace content in column of gridview (containing textbox) linkbutton. indeed, column contains html pages. , open new windows these pages html interprated when clik on linkbuttons.

for moment have :

<asp: templatefield headertext="data">   <itemtemplate>     <asp:label runat="server" id="data" text='<%#server.htmlencode(convert.tostring(databinder.eval(container.dataitem,"data"))) %>' />   </itemtemplate>   <edittemplate>     <asp:textbox runat="server" id="txtdata" text='<%#server.htmlencode(convert.tostring(databinder.eval(container.dataitem,"data"))) %>' />   </edittemplate> </asp:templatefield> 

can explain me how can proceed please ?

use

<asp:linkbutton runat="server" navigateurl='<%#eval("data") %>' /> 

in itemtemplate instead of textbox

edit :

make navigateurl="javascript:openwindow(my html)" // can use eval html string content on databinding.

javascript :

openwindow(myhtml) {     newwindow=window.open();     newdocument=newwindow.document;     newdocument.write(myhtml); } 

for more information check out reference : javascript dynamic document creation in new windows

edit :

my mistake :), replace navigateurl onclientclick becomes :

<asp:linkbutton id="linkbutton1" runat="server" text="click" onclientclick="javascript:openwindow('<%#eval("myfieldname") %>');return false;" />  

or instead of using linkbutton use anchor tag :

<a href="javascript:openwindow('<%#eval("myfieldname") %>');" runat="server" id="mylink" /> 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -