473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 15 '05 #1
2 2546
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 15 '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 15 '05 #3

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

Similar topics

8
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
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...
2
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"...
12
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.