Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > using databinding to codebehind in html

Reply
Thread Tools

using databinding to codebehind in html

 
 
rjl
Guest
Posts: n/a
 
      12-21-2005
How do you use variable in html tag, such as:
<a href="<%=getVariable%>Test</a>

thanks.

 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      12-21-2005
Well, the ASP.Net way would be to make that a server control and access it
in your page lifecycle:

<a id="test" runat="server" />

codebehind:
Protected test as HtmlAnchor

sub Page_load(...)
Test.HRef = "Blah.aspx"
end sub


if you insist on doing the <%=getVariable%> route, you'll need to define
getVariable as a protected string.

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"rjl" <> wrote in message
news: ups.com...
> How do you use variable in html tag, such as:
> <a href="<%=getVariable%>Test</a>
>
> thanks.
>



 
Reply With Quote
 
 
 
 
rjl
Guest
Posts: n/a
 
      12-22-2005
thanks, but I ahve dont that and it won't work, If I place the variable
on hte page (outside the tag description), it does render properly.
Thanks,

 
Reply With Quote
 
Karl Seguin
Guest
Posts: n/a
 
      12-22-2005
How and where is the variable declared? Is this inside a
repeater/datalist/datagrid?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"rjl" <> wrote in message
news: ups.com...
> thanks, but I ahve dont that and it won't work, If I place the variable
> on hte page (outside the tag description), it does render properly.
> Thanks,
>



 
Reply With Quote
 
rjl
Guest
Posts: n/a
 
      12-22-2005
it is a property in code behind (String)

 
Reply With Quote
 
Karl Seguin
Guest
Posts: n/a
 
      12-22-2005
Is it protected or public?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!



"rjl" <> wrote in message
news: oups.com...
> it is a property in code behind (String)
>



 
Reply With Quote
 
rjl
Guest
Posts: n/a
 
      12-24-2005
public.

 
Reply With Quote
 
Karl Seguin
Guest
Posts: n/a
 
      12-24-2005
Any time you might want to provide code

Are you sure it's being set ? When is it being set? If you are trying to
use it within a bound control (repeater, datalist, datagrid...), you might
need to use %# instead of %=

<a href='<%#getVariable%>'>Test</a>


--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!



"rjl" <> wrote in message
news: ups.com...
> public.
>



 
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
Databinding expressions are only supported on objects that have a DataBinding event jobs ASP .Net 0 09-25-2007 11:54 PM
Gridview encoding, or how to run commands before gridview's default databinding, or, how do I disable default databinding at all? Sergei Shelukhin ASP .Net 1 11-12-2006 01:43 PM
How to get two-way databinding work in codebehind (2.0)? dieter@schuele.name ASP .Net 1 11-23-2005 10:14 AM
URGENT-DataBinding expression in the codebehind Prince Mathew ASP .Net Web Controls 0 01-26-2005 05:14 AM
DataGrid Custom Column Error when DataBinding "does not contain a definition for 'DataBinding'" Earl Teigrob ASP .Net Datagrid Control 1 03-01-2004 04:52 AM



Advertisments