ajax method is executed after binding the href to the linkbutton..which should execute before
<p>I have an issue related to jquery when using colorbox plugins</p>

<pre><code>$("[id$=LinkButton1]").click(function() {

        var filename=$(this).text();


        $.ajax({
          type: "POST",
         url: "WebService.asmx/lnkbtn1",
         data: '{filename: \'' + filename + '\'}',

          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function(msg) {

         filename=msg.d;
             alert("filename1="+msg.d); ----------1.


          }

        });
         alert('Outside ');------2
       //  $(".iframe").attr('href',filename);---------3
         $(".iframe").colorbox({iframe:true, width:"50%", height:"100%"});

     });


        });
</code></pre>

<p>Here When i click on linkbutton with a filename in a gridview</p>

<pre><code> &lt;asp:TemplateField ShowHeader="False"&gt;
                &lt;ItemTemplate&gt;
                    &lt;asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandArgument='&lt;%#((GridViewRow)Container).RowIndex%&gt;'
                        Text='&lt;%# Bind("FileName") %&gt;' CommandName="ViewImages" CssClass="iframe"&gt;&lt;/asp:LinkButton&gt;
                &lt;/ItemTemplate&gt;
 &lt;/asp:TemplateField&gt;
</code></pre>

<p>I am using colorbox jquery plugin... here what happen is i get the filename... then that file name i pass to the webservice method(lnkbtn1), process the file name then I will get a filename from that i have to display it in popup colorbox...</p>

<p>But there is one issue here 2. is executed first and then 1. is executed so i am not able to bind file name to the 'href'</p>

<p><strong>EDIT</strong>
when the filename is passed to the webmethod it is first converted into html.. Suppose if the filetype is word document or excedlfile then its first convert to html. Suppose the file name is notes.doc.. then </p>

<ol>
<li>filename(notes.doc) is passed to the webmethod </li>
<li>convert notes.doc to notes.html    </li>
<li><p>webmethod returns notes.html</p>

<p>Reason for converting to html because the .doc file content will not display in iframe</p></li>
</ol>

<p>Please help...</p>
