Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Block codes

Reply
Thread Tools

Block codes

 
 
Rodrigo m. Ferreira
Guest
Posts: n/a
 
      09-09-2008
Whats wrong with this code?

on the default.aspx I have this:

<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click"
Text='<%=Titulo(); %>'></asp:LinkButton>

on the default.aspx.cs I have this:

private string Titulo()
{
return "Rodrigo";
}

In this case the function is not usefull, but i am just making some tests.
The problem is that the text of the LinkButton1 is blank.

Sorry about my bad english.

Thanks for helping!

 
Reply With Quote
 
 
 
 
Med
Guest
Posts: n/a
 
      09-10-2008
Try protected or public instead of private

protected string Titulo()
{
return "Rodrigo";
}

Or bettter way of assigning a value to you LinkButton text is:
LinkButton1.Text = "Rodrigo"; in your code behind.

Med

"Rodrigo m. Ferreira" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Whats wrong with this code?
>
> on the default.aspx I have this:
>
> <asp:LinkButton ID="LinkButton1" runat="server"
> onclick="LinkButton1_Click" Text='<%=Titulo(); %>'></asp:LinkButton>
>
> on the default.aspx.cs I have this:
>
> private string Titulo()
> {
> return "Rodrigo";
> }
>
> In this case the function is not usefull, but i am just making some tests.
> The problem is that the text of the LinkButton1 is blank.
>
> Sorry about my bad english.
>
> Thanks for helping!


 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      09-10-2008
You don't assign values to controls like this. Do it from your code behind:

LinkButton1.Text = Titulo();



"Rodrigo m. Ferreira" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Whats wrong with this code?
>
> on the default.aspx I have this:
>
> <asp:LinkButton ID="LinkButton1" runat="server"
> onclick="LinkButton1_Click" Text='<%=Titulo(); %>'></asp:LinkButton>
>
> on the default.aspx.cs I have this:
>
> private string Titulo()
> {
> return "Rodrigo";
> }
>
> In this case the function is not usefull, but i am just making some tests.
> The problem is that the text of the LinkButton1 is blank.
>
> Sorry about my bad english.
>
> Thanks for helping!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use file I/o codes with form and controls codes Allen ASP .Net 1 12-03-2007 12:04 AM
Fo:Block can you check to see if a block contains any text by using the block id? morrell XML 1 10-10-2006 07:18 PM
Virtual Key Codes, Scan Codes and ASCII Codes in C gj_williams2000@yahoo.co.uk C Programming 2 08-20-2005 11:04 AM
RegEx replace of html codes to ascii codes Greg -- ASP .Net 4 08-09-2005 07:27 PM



Advertisments