Problem with databinding expression

R

Roshawn Dawson

Hi,

I have a repeater control. This control will render a number of
textboxes on the page. Each textbox has its onblur event wired to a
JScript function. Here's a sample:

<asp:textbox onblur="blip(this,<%# Container.ItemIndex %>)"
text="<%#Container.DataItem("Quantity")%>" />

The binding expression included within the JScript function is giving me
trouble. That is, when the repeater is rendered on the page, the
binding expression passed as a param to the JScript function is not
invoked. Instead, it appears as is.

Is there something that I'm doing wrong?

Thanks,
Roshawn
 
P

Patrice

I would try :
onblur="<%# "blip(this," & Container.ItemIndex & ")" %>"

IMO the problem is that databinding expression are invoked when <%# begins
the property (not when present at some other place in the property).

Patrice
 
R

Roshawn Dawson

Thank you Patrice! That really helped. As a future reference, remember
to enclose the databinding expression in single quotes instead of double
quotes. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top