I know I'm just failing to grasp the concept of all this. I think I know what's wrong, but I can't seem to fix the problems I'm having. Can anyone point me in the right direction??
I'm trying to pass values between asp.net pages and running into all sorts of troubles. My code is generally (to date) written like this, all in a single aspx page.
The problem I think I'm having with this is quite difficult to describe!? I want to define a class that inherits from Page to encompass all the methods/properties I define within the script block, in order to inherit from the class in a second page accessed by Server.Transfer. If I do this, it seem to put all those methods I've defined within the script block outside of the namespace of the asp.net controls used within the html section at the bottom. This leads to errors such as
I've tried passing an Inherits="namespace.class" parameter to the Page directive, but to no avail.
I've tried splitting this all into two seperate files (html with a codebehind file) but end up running into the same problems.
I can create a vs.net project and it all seems to work fine, namespaces etc etc and I can't see how. Do I need something defined in global.asax in order to 'link' pages and namespaces??
Like I said, it seems pretty simple to see what I'm doing wrong, and I acknowledge that it's probably basic! But can anyone show me the right way to do this??
Thanks in advance
I'm trying to pass values between asp.net pages and running into all sorts of troubles. My code is generally (to date) written like this, all in a single aspx page.
Code:
<% page directive %>
<% import %>
<script runat="server">
private void Page_Load(object sender, EventArgs e) {
}
private void buttonClick(object sender, EventArgs e) {
}
</script>
<html>
<form runat="server">
<asp:button id="button1" runat="server" onClick="buttonClick"/>
</form>
</html>
The problem I think I'm having with this is quite difficult to describe!? I want to define a class that inherits from Page to encompass all the methods/properties I define within the script block, in order to inherit from the class in a second page accessed by Server.Transfer. If I do this, it seem to put all those methods I've defined within the script block outside of the namespace of the asp.net controls used within the html section at the bottom. This leads to errors such as
Code:
'ASP.RunReports_aspx' does not contain a definition for 'itemSelectionChanged'
I've tried splitting this all into two seperate files (html with a codebehind file) but end up running into the same problems.
I can create a vs.net project and it all seems to work fine, namespaces etc etc and I can't see how. Do I need something defined in global.asax in order to 'link' pages and namespaces??
Like I said, it seems pretty simple to see what I'm doing wrong, and I acknowledge that it's probably basic! But can anyone show me the right way to do this??
Thanks in advance