473,498 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Don't want to use codebehind...

M
Hello. I need an example of how to call an assembly function/method from a
webform page. I don't want to use a codebehind (nor embedded c# code), like
so:

<asp:DataGrid runat="server" id="Datagrid2" DataSource=<%#
getMyList(Convert.ToString(DataBinder.Eval(Contain er.DataItem, "Location")),
Convert.ToString(DataBinder.Eval(Container.DataIte m, "Type")))%>
AutoGenerateColumns="false">
In the above, getMyList is in a codebehind. Is there a way, and if there is,
what is the syntax, to call this method from the assembly c# code, rather
than the code behind?
Thanks in advance.
Nov 17 '05 #1
2 1132
M
Perhaps the "inherits" or "src" on the @page directive could point to the
proper assembly?

"M" <mi******@hotmail.com> wrote in message
news:a6********************@comcast.com...
Hello. I need an example of how to call an assembly function/method from a
webform page. I don't want to use a codebehind (nor embedded c# code), like so:

<asp:DataGrid runat="server" id="Datagrid2" DataSource=<%#
getMyList(Convert.ToString(DataBinder.Eval(Contain er.DataItem, "Location")), Convert.ToString(DataBinder.Eval(Container.DataIte m, "Type")))%>
AutoGenerateColumns="false">
In the above, getMyList is in a codebehind. Is there a way, and if there is, what is the syntax, to call this method from the assembly c# code, rather
than the code behind?
Thanks in advance.



Nov 17 '05 #2
Hi M,

You can include a namespace by using this sintax:

<% @Import Namespace="CTPCore" %>

Other thing, an assembly does not have function/methods , an assembly has
classes that in turn have methods , if you want to call a method that is a
member of a class then you must create an instance of this class ( unless
that the method be static ) and then you can call the method.

As in your example you have two ways to implement getMyList:
1- declare it in the page itself as you used to do in the old asp days :)
2- declare it in a class on the assembly, declare it as protected or public
, then declare that this page inherit from that other class using a
construction like:
note : I have never tested this before, but it should work
<%@ Page language="c#" AutoEventWireup="false"
Inherits="ASSEMBLY_NAME.CLASS_NAME" %>

Any of these two methods should work fine, now the big question, why you
don't want to use the codebehind mode?

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"M" <mi******@hotmail.com> wrote in message
news:a6********************@comcast.com...
Hello. I need an example of how to call an assembly function/method from a
webform page. I don't want to use a codebehind (nor embedded c# code), like so:

<asp:DataGrid runat="server" id="Datagrid2" DataSource=<%#
getMyList(Convert.ToString(DataBinder.Eval(Contain er.DataItem, "Location")), Convert.ToString(DataBinder.Eval(Container.DataIte m, "Type")))%>
AutoGenerateColumns="false">
In the above, getMyList is in a codebehind. Is there a way, and if there is, what is the syntax, to call this method from the assembly c# code, rather
than the code behind?
Thanks in advance.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1492
by: Krunom Ancini | last post by:
Hi, im just the beginner and im using c#-codebehind in my asp.net-application.... What should i do to make my application work "without" code-behind (without dll.-s in bin-folder)? I was...
2
2553
by: M | last post by:
Hello. I need an example of how to call an assembly function/method from a webform page. I don't want to use a codebehind (nor embedded c# code), like so: <asp:DataGrid runat="server"...
2
12426
by: exshige | last post by:
I read from some book that you can actually on any tag in the html page put a onClick or something and assign it with the sub/function name that is in the codebehind. I tried but it say name...
2
2869
by: Graham Allwood | last post by:
I'm reading the Essential ASP.NET book by Fritz onion and he says that when VS.NET creates a new .aspx page for you is uses the codebehind attribute on the Page directive rather than the src...
12
1626
by: Karl Hungus | last post by:
If I use a code behind class for an aspx page, what is the best way to get data from the codebehind class into my aspx page? I know about databinding, but is there a more basic way of just...
4
1868
by: Mat | last post by:
Hi, I am having a bit of a problem trying to access / set properties of a usercontrol from the parent codebehind. This is what I have so far.. simple.aspx <%@ Page...
13
1121
by: Leon | last post by:
Why this code is not working? I think the problem is in the business class code.when I select a state from the dropdownlist, the school dropdownlist suppose to fill with school names, but somehow...
6
1328
by: Leszek | last post by:
I wrote an aspx page. It shows datagrid with values: server | parameter --------------------- server1 | parameter1 server1 | parameter2 server1 | parameter3 server1 | parameter4 server1...
6
1545
by: antonyliu2002 | last post by:
Right now I put my VB code in the aspx pages. I would prefer to use codebehind, especially many of my VB functions may be shared across multiple aspx pages. I've tried a few pages with...
2
5377
by: mad.scientist.jr | last post by:
In .NET 2.0, is there any way to include comments in the aspx file that do not get rendered to the client (ie no <!-- -->) ? When I try to include C# comments in a code block in an aspx page,...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7167
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5464
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4915
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4593
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
657
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.