I'm new to umbraco and I have to migrate an existing web to it.
The old web is builded using .aspx pages which use javascript extensively and from it are called c# funtions, so forms have the atribute runat=server.
To migrate, I'm using user controls, I declare my forms tags (i.e. <form id="formulario" method="post" runat="server">) but when I run the page this declaration is always changed to <form method="post" action="my_page" id="aspnetForm">
What you have described, would seem to be the expected behavour. When a form tag with runat="server" is rendered as HTML, it will be rendered as a standard form tag like you've stated.
I think what Victor's saying (and I say this because I'm seeing the same on my install) is that it's changing the id of the form specified in the template. So, in my master template I declare the form as follows:
Ahh that's interesting. I'd just assumed it was Umbraco doing it rather than .net. Fortunately it's not really a problem in my site and I can work around it, but it's certainly something to bear in mind.
I did check, but as far as I can tell, the only place Umbraco touches the form tag is the action attribute because of the URL rewriting. Everything else it left to the default .NET implementation.
Matt, thanks for your link, but my real problem it isn't the id changed, it is that I need to access from javascript to the functions defined in .ascx.cs files, but if the atribute "runat=server" is deleted when HTML is rendering I couldn't do that.
perhaps if I translate the javascript functions to c# funtions I'll solve my problem...
function mostrar(elemento) { var elemento = document.getElementById(elemento); var response = RideSharing.conductores.AnadirRutas.CargarCasaUsuarioOrigen(); (fail in this line, "Ridesharing not found") CasaOrigen.innerHTML = response.value; elemento.style.display = ''; }
CargarCasaUsuarioOrigen is a function that returns a String, since window.location loads a page with this String, Is there any way to obtain this string whitout making a window.location?
Sorry for my english. I have a very similar issue than Victor Manuel. I made a web control using ajax and the tests in local .net debug server were all ok. But when I upload this user control to umbraco i get the same error than Victor Manuel. I have tried to fix the error with the indications above, but the error continue. The server can't locate /ajax/<HandlerName>.ashx.
I am using UMBRACO 4.7.0 in a IIS 7 server. To upload the user control I copied the .aspx to /usercontrol folder and i copied the ajax.dll and <userControlName>.dll to /bin folder.
At finish, i edited the web.config file and i added <add verb="POST,GET" path="/ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />
I remember that I had that problem when I uploaded the web to the production serverm, Windows Server 2008. In my case, It was problem of the IIS configuration.
My solution was change the application pool to the "Classic .NET AppPool".
Problems creating a form from a user control
Hi all,
First of all sorry for my english,
I'm new to umbraco and I have to migrate an existing web to it.
The old web is builded using .aspx pages which use javascript extensively and from it are called c# funtions, so forms have the atribute runat=server.
To migrate, I'm using user controls, I declare my forms tags (i.e. <form id="formulario" method="post" runat="server">) but when I run the page this declaration is always changed to <form method="post" action="my_page" id="aspnetForm">
Could someone help me?
thanks,
Víctor Manuel.
Hi Victor,
I'm not sure what you are saying the problem is?
What you have described, would seem to be the expected behavour. When a form tag with runat="server" is rendered as HTML, it will be rendered as a standard form tag like you've stated.
Can you explain your problem a little further?
Many thanks
Matt
I think what Victor's saying (and I say this because I'm seeing the same on my install) is that it's changing the id of the form specified in the template. So, in my master template I declare the form as follows:
Which then renders as:
<form method="post" action="my_page" id="aspnetForm">
Hi Jon / Victor
Ahhhh, I see.
Well it looks like this is an problem with asp.net when using a form tag in a master page.
Take a look at this forum post on asp.net for more info
http://forums.asp.net/p/883974/929349.aspx
Matt
Ahh that's interesting. I'd just assumed it was Umbraco doing it rather than .net. Fortunately it's not really a problem in my site and I can work around it, but it's certainly something to bear in mind.
Thanks for the help Matt!
No Problem,
I did check, but as far as I can tell, the only place Umbraco touches the form tag is the action attribute because of the URL rewriting. Everything else it left to the default .NET implementation.
Matt
Matt, thanks for your link, but my real problem it isn't the id changed, it is that I need to access from javascript to the functions defined in .ascx.cs files, but if the atribute "runat=server" is deleted when HTML is rendering I couldn't do that.
perhaps if I translate the javascript functions to c# funtions I'll solve my problem...
Hi Victor,
I still don't see how the runat="server" attribute would affect this.
Can you post some example code for your poblem area? ie javascript calls that aren't working?
Many thanks
Matt
Ok, here is some code of my web...
.ascx
something.js
Thanks,
Victor.
Hi Victor,
And how / where is
Defined?
Matt
oh, sorry, I forget to include ascx.cs file
Ahhh, ok.
I don't really have much experience using AjaxMethods or WebMethods. I know others have had issues, but not sure what there solutions were.
I tend to just use jQuery for my akax calls, and either use /base (http://umbraco.org/documentation/books/introduction-to-base) or just umbraco alternative templates to return the HTML.
Sorry I can't be of much help for your current method, but if you need more details on the other methods, please let me know.
Matt
Matt, /base solution has made me a good impresion. I've achieve to call a function in mi ascx.cs file from javascript, but making this:
CargarCasaUsuarioOrigen is a function that returns a String, since window.location loads a page with this String, Is there any way to obtain this string whitout making a window.location?
I don't know if I have explained well...
Victor.
Hi Victor,
I'd look into using one of the jQuery ajax methods to make the request and load the result (http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/).
If you just want to load a string, and handle it once loaded, look into jQuery.get
Cheers
Matt
Hi all,
I just solve my proble. All were alright except I hadn't configured my web.confg to can use ajax in my web.
This two lines were missing:
Thank you very much.
Víctor.
Hi Victor.
Excellent work figuring this one out, am sure it will help others in future, and glad you got your project working.
Matt
Hi to all,
Sorry for my english. I have a very similar issue than Victor Manuel. I made a web control using ajax and the tests in local .net debug server were all ok. But when I upload this user control to umbraco i get the same error than Victor Manuel. I have tried to fix the error with the indications above, but the error continue. The server can't locate /ajax/<HandlerName>.ashx.
I am using UMBRACO 4.7.0 in a IIS 7 server. To upload the user control I copied the .aspx to /usercontrol folder and i copied the ajax.dll and <userControlName>.dll to /bin folder.
At finish, i edited the web.config file and i added <add verb="POST,GET" path="/ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />
Can anybody help me?
Thanks
Hi acasado!,
I remember that I had that problem when I uploaded the web to the production serverm, Windows Server 2008. In my case, It was problem of the IIS configuration.
My solution was change the application pool to the "Classic .NET AppPool".
Best Regards.
Hola Victor (he visto que eres Pucelano)!!!
Thanks for your response. It was very useful for me. The problem was solved changing the AppPool to the Clasic .net.
is working on a reply...