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

DataBinding expressions are not evaluated on Custom Properties of a UserControl

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>
Nov 18 '05 #1
2 1642
"Jason Wright via .NET 247" <an*******@dotnet247.com> wrote in message
news:u6**************@TK2MSFTNGP09.phx.gbl...
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
Nov 18 '05 #2
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" <an*******@dotnet247.com> wrote in message
news:u6**************@TK2MSFTNGP09.phx.gbl...
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>

Nov 18 '05 #3

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

Similar topics

2
by: John B | last post by:
Hello I want to create a set of controls that have some common methods and properties. I was thinking that I should subclass the UserControl class and add these common features there and then...
1
by: chambersdon | last post by:
How do I get the public properties of my custom control to show in the designer. The properties are all Strings but they do not show up in the designer property window. My custom control...
3
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method,...
2
by: Mr Newbie | last post by:
Ive got the basic idea behind DataBinding Expressions, but I have a couple of questions, Ok its four actually :) Q1.) It would appear that if you use Page.DataBind that all child controls and...
13
by: Michael Maes | last post by:
Hi, I have a UserControl containing some controls of which one is a ComboBox. All the InternalControls are Private and some are allowed to be accessed through Public Methods. One of the things I...
2
by: Daniel Friend | last post by:
Hello, I have added a custom usercontrol programically and all works fine... I would like to change some custom properties that I have set in that usercontrol. Any help would be greatly...
0
by: Daniel Friend | last post by:
Hello, I have added a custom usercontrol programically and all works fine... I would like to change some custom properties that I have set in that usercontrol. Any help would be greatly...
2
by: AMDRIT | last post by:
Hello everyone, I have created a custom component and one of its properties is a class object with it's own properties. During runtime, I can assign values to the class object properties just...
11
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...

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.