Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataBinding expressions are not evaluated on Custom Properties of a UserControl

Reply
Thread Tools

DataBinding expressions are not evaluated on Custom Properties of a UserControl

 
 
Jason Wright via .NET 247
Guest
Posts: n/a
 
      06-05-2004
Hiya,

I've created a UserControl with some Custom properties and assigned databinding expressions to the properties in the aspx. Does anyone know why these expressions are not being evaluated?

eg.
<uc1:ControlX id="la" runat="server" ClientClick='javascriptfunction(<%# DataBinder.Eval(Container.DataItem, "Id")%>)' />

after processing renders in html as

<table id="la" [other attributes] onclick="javascriptfunction(<%# DataBinder.Eval(Container.DataItem, &quot;Id&quot %>)">

instead of

<table id="la" [other attributes] onclick="javascriptfunction(1)">

ControlX is implemented as follows:

public class ControlX : UserControl
{
private HtmlTable tableControl;

[other stuff]

public string ClientClick
{
set
{
tableControl.Attributes["onclick"] = value;
}
}

[other stuff]
}

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>EQjGw+v9EkOrDqH+z7828A==</Id>
 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      06-05-2004
"Jason Wright via .NET 247" <> wrote in message
news:...
> Hiya,
>
> I've created a UserControl with some Custom properties and assigned

databinding expressions to the properties in the aspx. Does anyone know why
these expressions are not being evaluated?
>
> eg.
> <uc1:ControlX id="la" runat="server" ClientClick='javascriptfunction(<%#

DataBinder.Eval(Container.DataItem, "Id")%>)' />

What happens when you do the exact same thing to a label control?
--
John Saunders
johnwsaundersiii at hotmail


 
Reply With Quote
 
 
 
 
Brian W
Guest
Posts: n/a
 
      06-12-2004
I'm seeing this same problem on any thing that has a runat=server attribute
have you found a solution to this problem?

This:
<a runat="server" href='./check.aspx?x=<%# MyValue%>'>Check This</a>

produces:
<a href="./check.aspx?x=<%# MyValue%>">Check This</a>

and this:
<asp:hyperlink runat="server" NavigateUrl='./check.aspx?x=<%#
MyValue%>'>Check This Too</asp:hyperlink>

also produces
<a href="./check.aspx?x=<%# MyValue%>">Check This</a>

however this:
<a href="./check.aspx?x=<%# MyValue%>">Check This</a>

produces:
<a href="./check.aspx?x=whatevervalue">Check This</a>


TIA
Brian W



"Jason Wright via .NET 247" <> wrote in message
news:...
> Hiya,
>
> I've created a UserControl with some Custom properties and assigned

databinding expressions to the properties in the aspx. Does anyone know why
these expressions are not being evaluated?
>
> eg.
> <uc1:ControlX id="la" runat="server" ClientClick='javascriptfunction(<%#

DataBinder.Eval(Container.DataItem, "Id")%>)' />
>
> after processing renders in html as
>
> <table id="la" [other attributes] onclick="javascriptfunction(<%#

DataBinder.Eval(Container.DataItem, &quot;Id&quot %>)">
>
> instead of
>
> <table id="la" [other attributes] onclick="javascriptfunction(1)">
>
> ControlX is implemented as follows:
>
> public class ControlX : UserControl
> {
> private HtmlTable tableControl;
>
> [other stuff]
>
> public string ClientClick
> {
> set
> {
> tableControl.Attributes["onclick"] = value;
> }
> }
>
> [other stuff]
> }
>
> -----------------------
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
>
> <Id>EQjGw+v9EkOrDqH+z7828A==</Id>



 
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
Databinding expression not evaluated - problem mikeon@icpnet.pl ASP .Net 0 09-12-2005 10:12 AM
Databinding to custom properties of a custom class in ASP.NET 2 =?Utf-8?B?SW1hciBTcGFhbmphYXJz?= ASP .Net 0 04-20-2005 07:34 PM
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
JSTL problem, expressions not being evaluated in c:out Chris Java 1 01-09-2004 03:05 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57