Hi,
Is there a way to call a codebehind method/function from an attribute
of a runat=server tag, kinda like this:
<asp:Literal runat="server" ID="litTest" Text='<%#
MyMethod("testa rgs") %>' />
but obviously that doesn't work :(
Thanks
Andrew 12 11061
<tr******@googl email.comwrote in message
news:11******** **************@ r34g2000hsd.goo glegroups.com.. .
Is there a way to call a codebehind method/function from an attribute
of a runat=server tag, kinda like this:
<asp:Literal runat="server" ID="litTest" Text='<%#
MyMethod("testa rgs") %>' />
but obviously that doesn't work :(
1) Make sure MyMethod returns a string
2) Make sure MyMethod has either protected or public scope
3) Change <%# to <%=
--
Mark Rae
ASP.NET MVP http://www.markrae.net tr******@google mail.com wrote:
Hi,
Is there a way to call a codebehind method/function from an attribute
of a runat=server tag, kinda like this:
<asp:Literal runat="server" ID="litTest" Text='<%#
MyMethod("testa rgs") %>' />
but obviously that doesn't work :(
Thanks
Andrew
I prefer to put the code in the code behind:
litTest.Text = MyMethod("testa rgs");
--
Göran Andersson
_____ http://www.guffa.com
On 1 Aug, 13:13, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
<trull...@googl email.comwrote in message
news:11******** **************@ r34g2000hsd.goo glegroups.com.. .
Is there a way to call a codebehind method/function from an attribute
of a runat=server tag, kinda like this:
<asp:Literal runat="server" ID="litTest" Text='<%#
MyMethod("testa rgs") %>' />
but obviously that doesn't work :(
1) Make sure MyMethod returns a string
2) Make sure MyMethod has either protected or public scope
3) Change <%# to <%=
--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
Hi,
I tried that but it just literally writes out: <%=
MyMethod("testa rgs") %into the resultant html.
:(
Goran, I cant do that for a complicated reason that i wont rabble on
about here. I just need to be able to do it from the html, not the
codebehind.
Any other ideas anyone?
Thanks
<tr******@googl email.comwrote in message
news:11******** **************@ l70g2000hse.goo glegroups.com.. .
Does this work:?
<asp:PlaceHolde r ID="litTest"
runat="server"> <%=MyMethod("te stargs")%></asp:PlaceHolder >
--
Mark Rae
ASP.NET MVP http://www.markrae.net
This should work, if you just call litTest.DataBin d() in code when you want
it to be "called". <%# refers to a databinding expression when something
must call DataBind() for the control for databinding to occur.
--
Teemu Keiski
AspInsider, ASP.NET MVP http://blogs.aspadvice.com/joteke http://teemukeiski.net
<tr******@googl email.comwrote in message
news:11******** **************@ r34g2000hsd.goo glegroups.com.. .
Hi,
Is there a way to call a codebehind method/function from an attribute
of a runat=server tag, kinda like this:
<asp:Literal runat="server" ID="litTest" Text='<%#
MyMethod("testa rgs") %>' />
but obviously that doesn't work :(
Thanks
Andrew
On 1 Aug, 14:45, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
<trull...@googl email.comwrote in message
news:11******** **************@ l70g2000hse.goo glegroups.com.. .
Does this work:?
<asp:PlaceHolde r ID="litTest"
runat="server"> <%=MyMethod("te stargs")%></asp:PlaceHolder >
--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
'System.Web.UI. WebControls.Lit eral' does not allow child controls.
:(
Andrew
On 1 Aug, 15:49, "Teemu Keiski" <jot...@aspalli ance.comwrote:
This should work, if you just call litTest.DataBin d() in code when you want
it to be "called". <%# refers to a databinding expression when something
must call DataBind() for the control for databinding to occur.
--
Teemu Keiski
AspInsider, ASP.NET MVPhttp://blogs.aspadvice .com/jotekehttp://teemukeiski.net
<trull...@googl email.comwrote in message
news:11******** **************@ r34g2000hsd.goo glegroups.com.. .
Hi,
Is there a way to call a codebehind method/function from an attribute
of a runat=server tag, kinda like this:
<asp:Literal runat="server" ID="litTest" Text='<%#
MyMethod("testa rgs") %>' />
but obviously that doesn't work :(
Thanks
Andrew
Hi, Yeah i know i can call databind and use a # in the server tags,
but i want to avoid any codebehind. (if im calling databind i might as
well just do literal.text = "value";
Thanks for the suggestion anyway :)
<tr******@googl email.comwrote in message
news:11******** *************@d 55g2000hsg.goog legroups.com...
>Does this work:?
<asp:PlaceHold er ID="litTest" runat="server" ><%=MyMethod("t estargs")%></asp:PlaceHolder >
-- Mark Rae ASP.NET MVPhttp://www.markrae.net
'System.Web.UI. WebControls.Lit eral' does not allow child controls.
Once again - does this work:?
<asp:PlaceHolde r ID="litTest"
runat="server"> <%=MyMethod("te stargs")%></asp:PlaceHolder >
Please read carefully...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
You can also do it on the aspx side if you use <script
runat="server"> ...</scriptblock, no need to touch the code-behind ;-)
--
Teemu Keiski
AspInsider, ASP.NET MVP http://blogs.aspadvice.com/joteke http://teemukeiski.net
<tr******@googl email.comwrote in message
news:11******** **************@ k79g2000hse.goo glegroups.com.. .
On 1 Aug, 15:49, "Teemu Keiski" <jot...@aspalli ance.comwrote:
>This should work, if you just call litTest.DataBin d() in code when you want it to be "called". <%# refers to a databinding expression when something must call DataBind() for the control for databinding to occur.
-- Teemu Keiski AspInsider, ASP.NET MVPhttp://blogs.aspadvice .com/jotekehttp://teemukeiski.net
<trull...@goog lemail.comwrote in message
news:11******* *************** @r34g2000hsd.go oglegroups.com. ..
Hi,
Is there a way to call a codebehind method/function from an attribute
of a runat=server tag, kinda like this:
<asp:Literal runat="server" ID="litTest" Text='<%#
MyMethod("testa rgs") %>' />
but obviously that doesn't work :(
Thanks
Andrew
Hi, Yeah i know i can call databind and use a # in the server tags,
but i want to avoid any codebehind. (if im calling databind i might as
well just do literal.text = "value";
Thanks for the suggestion anyway :) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Supa Hoopsa |
last post by:
I am using a treeview and within each node, I want to store the name of the
function that was called to create the node's data.
Then whenever a user selects this node, I want to be able to call that
function without having to create a huge SELECT CASE statement.
i.e.
Node.123's data is created in a function called "fnGetProjectDetails"
|
by: JoeK |
last post by:
Hey all,
I am automating a web page from Visual Foxpro. I can control all the
textboxes, radio buttons, and command buttons using syntax such as:
oIE.Document.Forms("searchform").Item(<name>).Value = <myvalue>
But I cannot control a dropdown with an onchange event. I can set the
dropdown's value and selectedIndex, but then calling the onChange() or
Click() does not do anything. It only seems to fire the onchange if I
|
by: wierus |
last post by:
Hello, i have a problem. I write my first class in python so i'm not a
experience user. I want to call a function in another function, i tried to
do it in many ways, but i always failed:(
I supposed it's sth very simple but i can't figure what it is:
==================================
class ludzik:
x=1
y=2
l=0
def l(self):
|
by: Matt Clepper |
last post by:
Any way to do this? I need to call functions based on a variable. Do I
actually have to make a case statement and call each funciton explicitly, or
is there any way to call a function where the funciton name is a variable.
Example:
dim variable as string
variable = "thisfunction()"
call variable <---this will not work
|
by: dale zhang |
last post by:
Hi,
I have the following private function in one page:
private string Connect()
{
string sConnect;
// this value could go directly in the Global.asax.vb declarations
switch (((string)(Application)).ToLower())
{
| |
by: John |
last post by:
Hi all,
This really is quite an urgent matter.
I have a page with multiple, dynamically-loaded user controls and when a
user clicks on a button, the whole form is submitted. Now at this stage I
know I need to call a function that will save data but I'm not sure exactly
when to call this function.
I've tried two ways and both seem to have 'gotcha's':
|
by: grist2mill |
last post by:
I want to create a standard tool bar that appears on all pages that is
a control. The toolbar has a button 'New'. What I wolud like when the
user clicks on 'New' depends on the page they are on. I would like to
do this by defining a NewFunc() that is different in each
(code-behind) page which is called by the standard 'New' button in the
toolbar.
How can I get this to work? So far I have the following (which doesnt
work). When the user...
|
by: comp |
last post by:
I have a user control inside an aspx page. I was able to
create a Public property inside the ascx file and call it
from the aspx but whatever I do, I can't find the way to
cause an event from inside the ascx file to call any
function/sub/property etc. The error I'm getting
is "Reference to a non-shared member required an object
reference".
|
by: bushi |
last post by:
hi every one!
i want to call a function of the code file into my
javascript code.is it possible?how can i call it?any one knows about
it plz rply me as soon as possible,any help will be appriciated
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |