|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with databinding expressionHi,
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 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 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 > Change:
> <asp:textbox onblur="blip(this,<%# Container.ItemIndex %>)" To (notice single quotes):> text="<%#Container.DataItem("Quantity")%>" /> <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
Other interesting topics
FCKeditor implementation in ASP.NET
IndexOutOfBounds on databinding aspNetEmail with Asp.net Problems with Update and MySqlDataAdapter Required field validator System.NullReferenceException raised on site ASP vs ASP.NET link on datagrid Arrays and DataReader DirectorySearcher - whats wrong with this?! |
|||||||||||||||||||||||