Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp.net namespace problems

Status
Not open for further replies.

nooro

Programmer
Feb 7, 2003
22
GB
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.

Code:
<% page directive %>
<% import %>
<script runat=&quot;server&quot;>

private void Page_Load(object sender, EventArgs e) {

}

private void buttonClick(object sender, EventArgs e) {

}

</script>
<html>
<form runat=&quot;server&quot;>
<asp:button id=&quot;button1&quot; runat=&quot;server&quot; onClick=&quot;buttonClick&quot;/>
</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 passing an Inherits=&quot;namespace.class&quot; 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top