Page 1 of 1

File Conversion

Posted: Mon Nov 02, 2015 10:11 am
by ZPCAC
Hello -

I am trying to convert my .ascx.cs to .ascx and i am unsure of how to do so.

Some direction would be appreciated.

Thanks

Re: File Conversion

Posted: Mon Nov 02, 2015 10:23 am
by mazhar
If you don't want codebehind file then what you need is to edit your ascx file and update its first line to look something like this

Code: Select all

<%@ Control Language="C#" ClassName="MyCustomControlName" %>
then copy the functions from .ascx.cs file and put them into acx file right after the page directive mentioned in above code wrapped in script tags like

Code: Select all

<%@ Control Language="C#" ClassName="MyCustomControlName" %>
<script runat="server">
   
</script>

...........
...........
the rest of ascx code can stay after closing of script tag.

Re: File Conversion

Posted: Mon Nov 02, 2015 11:13 am
by ZPCAC
Okay currently I have a .ascx.cs and a .ascx file. If I make changes to one do I have to edit or resave the other ?