locked
Calling a c# code page on a .aspx page RRS feed

  • Question

  • User-458598543 posted

    Hello,

    I set the problem of calling a c# code page on a .aspx page.

    I've got the error's message : Message d'erreur de l'analyseur: Impossible de charger le type 'TestPro_20180123.W_AccueilD'.

    The script is :

    • .aspx page :

    <%@ Page Language="C#" CodeBehind="W_AccueilD.aspx.cs" AutoEventWireUp="true" Inherits="TestPro_20180123.W_AccueilD" %>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">

    • c# behind page :

    namespace TestPro_20180123
    {
        public partial class W_AccueilD : System.Web.UI.Page
       {

    protected void Page_Load(object sender, EventArgs e)
            {

    } } }

    Trust and peace !

    Tuesday, January 23, 2018 5:20 PM

Answers

All replies

  • User-359936451 posted

    I think you have some confusion here. 

    This part in bold

    <%@ Page Language="C#" CodeBehind="W_AccueilD.aspx.cs"

    tells the aspx page hoe to locate the code behind C# code.

    What is you are trying to do?

    Tuesday, January 23, 2018 8:04 PM
  • User-458598543 posted

    Hello,

    Well, my goal is to associate a .cs code behind page to an .aspx page. When I put only CodeBehind="W_AccueilD.aspx" without inherits, the functions as Click doesn't operationals.

    Perhaps, you know a method to associate .cs page to .aspx page ?

    Thanks, god with trust !

    Marc-Antoine

    Wednesday, January 24, 2018 11:32 AM
  • User-1838255255 posted

    Hi Rednuts72,

    According to your description and code, maybe you create W_AccueilD page, then generate W_AccueilD.aspx.cs automatically, i think your code is generate automatically, so it should work. 

    Also you could check this tutorial about how to associate the page.aspx and page.aspx.cs: 

    How to add code behind file to existing page: 

    https://blogs.msdn.microsoft.com/mikhailarkhipov/2006/04/13/how-to-add-code-behind-file-to-existing-page/

    Best Regards,

    Eric Du

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 25, 2018 2:45 AM
  • User-458598543 posted

    Hello Eric Du,

    Good to your answer, I charge the header parameters of .aspx page and the files code behind is associated to the .aspx page.

    Have a nice day !

    Rednuts72

    Thursday, January 25, 2018 9:23 AM