Hi James,
Just checking that it isn't just a typo? See the spelling of DataBindiner
Ken
"msnews.microsoft.com" <~> wrote in message
news:%...
> Here's a tough one, but one I've run into serveral times now.
>
> I know that you can use DataBinder.Eval(Container, "Field") to set a value
> of a control in an item template. Works great.
>
> However I need to do some inline code, because some of the items I need to
> display one set of controls, and some of the items I need to display
> another set of controls based on the value in the record.
>
> So I tried to do this:
>
> <%if (DataBindiner.Eval(Container, "Field").ToString() == string.Empty)
> {%>
> HTML controls
> <%} else {%>
> Some other HTML Controls
> <%}%>
>
> What I get is an error that container doesn't exist.
>
> Does anyone know how I can get the value of a field and then have the
> above if work correctly?
>
> I tried setting it to a label's text property (that works fine) and then
> testing the label's text property in the if, but of course that doesn't
> work, because it doesn't know that control because it's part of the
> ItemTemplate.
>
> Thanks!
> James Hancock
>
|