Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

get return value of ajax and put it into a popup div

$
0
0

hi all..i have a problem and that is. 

in a on clientclick event i send some data to a ajax function .and i get the desire data from webmethod.my code is hear.

//onclick event<asp:TemplateField ItemStyle-CssClass="hr" ><ItemTemplate><asp:LinkButton ID="lnktittle" OnClientClick='<%# string.Format("javascript:return showpopup(\"{0}\")", Eval("PostId")) %>' Text='<%# Eval("Tittle") %>' CssClass="post_tittle" runat="server"></asp:LinkButton></ItemTemplate><HeaderStyle HorizontalAlign="Left" /></asp:TemplateField>

my ajax function:

function showpopup(PostId)
                {
                    alert(PostId);$.ajax({
                        type: "POST",
                        url: "viewprojectdetails.aspx/getdatafromgridview",
                        data: '{PostId: "' + PostId + '" }',
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (r) { 

                        }

                    }); 
               
                }

my web method:

 [WebMethod]
  public static postpagemass getdatafromgridview(string PostId)
  {
      postpagemass objpost = new postpagemass(conection.ConnectionString);
      objpost.GetRowfrompost(Convert.ToInt32(PostId));


      return objpost;
  }

hear i return a single object ..Now i want to show my data into a popup my popup div is.

<div class="postdiv" id="postbackgroundpopup"><div id="postmanuepopup" class="displaypostdetails"><asp:HiddenField ID="hdid" runat="server" /><div class="postpopupdetailsdiv"><div class="displayparentpostleft"><asp:Label ID="lblshowtittle" runat="server" ></asp:Label><br/>
  Posted By <asp:Label ID="lblshowusername" runat="server"></asp:Label> 
 on<asp:Label ID="lblshowpost_date" runat="server"></asp:Label><br/>
 Discussion are hear:-<asp:Label ID="lblbody" runat="server"></asp:Label></div><div class="displayparentpostright"><a href="#" class="editpost">Edit</a><br/><hr/><a href="#" class="editpost">Delete</a></div></div>

i want to sjow my data in this lable and show the popup div...but i dont know how to write the code in javascript...

thanks to replay...





Viewing all articles
Browse latest Browse all 5678

Trending Articles