Using Jquery and Ajax in ASP.NET
Posted
by xkcd
on Stack Overflow
See other posts from Stack Overflow
or by xkcd
Published on 2010-06-11T15:05:12Z
Indexed on
2010/06/11
15:13 UTC
Read the original article
Hit count: 263
I am using ajax and jquery to load contents into a div.
My jquery looks like this
$("a.trigger").click(function() {
$.ajax({
type: "POST",
url: "GetStuff.aspx",
data: "id=0",
success: function(response){
$("#contentDiv").html(response);
}
});
});
In GetStuff.aspx I would like to write some asp.net html controls like
private void Page_Load(object sender, System.EventArgs e)
{
Response.Expires = -1;
Response.ContentType = "text/plain";
Response.Write("<asp:Label id=\"label1\" runat=\"server\" text=\"helloworld\"/>");
Response.End();
}
However the label does not appear on the page.
I tried to put the asp:Label in my aspx file like this
<%@ Page Language="C#" Inherits="Untitled.GetStuff" %>
<asp:Label id="label12" runat="server" text="helloworld2"/>
It also does not work. How can I get asp.net html controls to show up?
© Stack Overflow or respective owner