简体   繁体   中英

To Load user control using ajax

In the below Code i have a user control i want to bind user control using ajax web method.I tried no idea to solve it .Pls help me to solve the issue.

Sample.aspx

<test:school ID="usr" runat="server"/>


[WebMethod]
public static string LoadUserControl()
{
 TestSchool.SchoolBusinessLyr.SchoolBizClient SelectDistrict = new TestSchool.SchoolBusinessLyr.SchoolBizClient();
            DataSet ds = new DataSet();
ds = SelectDistrict.SelectDistrict();
usr.field=ds.Tables[0];
usr.DataBind();
}

You can't bind an existing user control using AJAX; you can return data to the client, which JavaScript can then update the UI where the user control is (programmatically), or you can use an UpdatePanel to update the UI from the server... you can also return the HTML of the user control, but that is a little more complicated...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM