473,387 Members | 1,515 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,387 software developers and data experts.

Is possible to use a method in a LinkButton declaration?

Hello,

If I code this:

[...]
<script language="c#" runat="server">
void Page_Load() {
Page.DataBind();
}

string giveMeAValue() {
string value = "here you have";
return value;
}
string giveMeAValue( aValue ) {
// some logic to determine the value
return value;
}

</script>

[...]

<form runat="server">
<asp:LinkButton CommandName="Sort" CommandArgument="login ASC" Text="<%#
giveMeAValue() %>" runat="server" />
</form>
[...]

It works fine, but if I try to pass a static parameter in the
giveMeAValue method like this:
[...]
<form runat="server">
<asp:LinkButton CommandName="Sort" CommandArgument="login ASC" Text="<%#
giveMeAValue( "aValue" ) %>" runat="server" />
</form>
[...]

It just says it's a malformed server tag.

Is there any way of passing a parameter in the TextField of a
LinkButton?

Thanks

Carlos CR
Nov 18 '05 #1
2 920
Carlos, try:

<asp:LinkButton CommandName="Sort" CommandArgument="login ASC"
Text='<%# giveMeAValue( "aValue" ) %>' runat="server" />

Note that I changed the " around the value for Text to '

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
Nov 18 '05 #2
"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in
news:Qi*****************@newssvr27.news.prodigy.co m:
Carlos, try:

<asp:LinkButton CommandName="Sort" CommandArgument="login ASC"
Text='<%# giveMeAValue( "aValue" ) %>' runat="server" />

Note that I changed the " around the value for Text to '


Thank you very much. It works! :)

Regards

Carlos CR
Nov 18 '05 #3

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

Similar topics

0
by: Matt Law | last post by:
Hi All, Ive just attempted to use a <ASP:LinkButton> on a ASCX User Control. The .NET system produces the HTML/Javascript that doesnt work... Now before you all scream OnCommand, OnClick...
8
by: Heiner | last post by:
Hi! The following snippet class B; class A { public:
1
by: Ryan McLean | last post by:
Hi everyone! What is happening is the method: sub_btnSubmitClicked is being executed every time any other object with a Handler is executed. I am trying not to use the withevents and handles...
0
by: Solomon Shaffer | last post by:
This is very interesting - and odd. I have a number of LinkButtons that are created in a custom data grid that I created. The purpose of the LinkButtons is to provide alphabetical filtering...
0
by: Li-fan Chen | last post by:
Hi guys, I don't know how Hotmail and Gmail pulls it off, but when you need to attach a file to your email, you just click a linkbutton and a file picker pops up. And when it closes it...
0
by: Keith | last post by:
I have a web form that contains a repeater control that is designed to ask like a check book register. Clicking on a certain transaction takes the user to a different .aspx page where it can be...
0
by: Keith | last post by:
I have a web form that contains a repeater control that is designed to ask like a check book register. Clicking on a certain transaction takes the user to a different .aspx page where it can be...
0
by: HillBilly | last post by:
MasterPages again. Three LinkButtons are being used as styled tabs in the content page that will load a different ListView when a tab is selected: TabA, TabB or TabC. The LinkButtons are declared...
2
by: =?Utf-8?B?QWxleA==?= | last post by:
I have an asp linkbutton declared as follows: <asp:LinkButton ID="LinkButton1" runat="server" CssClass="tt">ASP Link Button</asp:LinkButton> My CSS classes are declared as follows: a.tt {...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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,...

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.