Search Results

Search found 2 results on 1 pages for 'raika'.

Page 1/1 | 1 

  • Add UserControl To Page From Another Class

    - by Raika
    I have page and call method inside my page. I want to add some control to my page Control (not page itself) inside that method. namespace Program { public partail class Default : Page { protected void Page_Load(object sender, Eventargs e) { MyClass.Calling(this); } } } in another class namespace Program { public class MyClass { public static void Calling(Page page) { Textbox txt = new Textbox() // I want somthing like this. // page.PlaceHolder1.Controls.Add(txt); } } } Is this possible? My Default.aspx : <%@ Page Title="Home Page" MasterPageFile="~/Site.master" ... %> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> </asp:Content> Update: thanks to The King for help. his suggest work correctly if control is inside page not Content of master page like my defualt sample code.

    Read the article

  • Load ascx via jQuery

    - by Raika
    Is there a way to load ascx file by jQuery? UPDATE: thanks to @Emmett and @Yads.i am use the handler and the ajax: jQuery.ajax({ type: "POST", //GET url: "Foo.ashx", data: '{}', contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { jQuery('#controlload').append(response.d); // or response }, error: function () { jQuery('#controlload').append('error'); } }); but i,m just getting an error. my ajax is wrong? Another Update : i am using error: function (xhr, ajaxOptions, thrownError) { jQuery('#controlload').append(thrownError); } and this what i get : Invalid JSON: Test =(this test is label inside my ascx) and my ascx file after Error!!! Another Update : my ascx file is somthing like this: <asp:DropDownList ID="ddl" runat="server" AutoPostBack="true"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> </asp:DropDownList> <asp:Label ID="Label1" runat="server">Test</asp:Label> but when I call ajax i get this error in asp: :( Control 'ctl00_ddl' of type 'DropDownList' must be placed inside a form tag with runat=server.

    Read the article

1