Home All Groups Group Topic Archive Search About

Problem with databinding expression

Author
21 Mar 2005 1:20 PM
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

Author
21 Mar 2005 1:34 PM
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

--

Show quoteHide quote
"Roshawn Dawson" <udr***@bellsouth.net> a écrit dans le message de
news:OJnsTjhLFHA.244@TK2MSFTNGP12.phx.gbl...
> 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
Are all your drivers up to date? click for free checkup

Author
21 Mar 2005 2:08 PM
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.  :-)

Patrice wrote:
Show quoteHide quote
> 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
>
Author
21 Mar 2005 5:39 PM
Brock Allen
Change:

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

To (notice single quotes):

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

-Brock
DevelopMentor
http://staff.develop.com/ballen



Show quoteHide quote
> 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

Bookmark and Share