The ascx is used to create or define custom usercontrols to be placed onto web pages.
Questions tagged [ascx]
569 questions
42
votes
8 answers
How to call an ASP.NET WebMethod in a UserControl (.ascx)
Is it possible to place a WebMethod in an ascx.cs file (for a UserControl) and then call it from client-side jQuery code?
For some reasons I can't place the WebMethod code in an .asmx or .aspx file.
Example: In ArticleList.ascx.cs I have the…

gruber
- 28,739
- 35
- 124
- 216
33
votes
8 answers
Is there a way to use "<%= someObject.ClientID %>" in an external javascript file?
Is there a way to use "<%= someObject.ClientID %>" in an external javascript file?
If I use the code
<%= someObject.ClientID %>
in a script tag inside my as(c/p)x page, it works fine. On the rendered page, the ClientID is resolved.
Howvever, if I…

Matt
- 25,943
- 66
- 198
- 303
29
votes
6 answers
Pass data from a ASP.NET page to ASCX user controls loaded dynamically
I'm developing an ASP.NET application with C# and Ajax.
I have a page that holds user controls loaded dynamically. I need to pass some data (integer values and some strings) to the user control that has been loaded dynamically.
Now I use Session to…

VansFannel
- 45,055
- 107
- 359
- 626
19
votes
3 answers
Use a legacy ASP.NET ASCX User Control in MVC Razor view
I am trying to implement a MVC Razor _Layout.cshtml page that uses a WebForm ascx User Control (non-MVC). I am doing this based off the "Yes" section of this Scott Hansleman article "Mixing Razor Views and WebForms Master Pages with ASP.NET MVC 3"…

Walter
- 363
- 1
- 4
- 16
17
votes
2 answers
ASP.NET error: The page Y.ascx cannot use the user control X.ascx
I am getting the error below when trying to build the web site project in Visual Studio 2010:
The page '/WebSite/controls/C2.ascx' cannot use the user control '/WebSite/controls/C1.ascx', because it is registered in web.config and lives in the same…

michalstanko
- 579
- 5
- 19
11
votes
2 answers
MVC3 Razor: Is it Possible to Render a Legacy ASCX?
With the Razor view engine in MVC3,
Is it possible to render a legacy ascx?
I was expecting to be able to do something like:
@Html.RenderPartial("Footer.ascx")

Jim G.
- 15,141
- 22
- 103
- 166
11
votes
2 answers
Custom control becomes generic "UserControl" and not its actual type in Designer class
I have a custom control in ASP.NET (VB.NET in code behind), defined with an ASCX:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="MyControl.ascx.vb" Inherits="Mynamespace.Controls.MyControl" %>