By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,948 Members | 1,857 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,948 IT Pros & Developers. It's quick & easy.

Concatenating two databinding expressions - how??

P: n/a
Hi,

I want to assign two data values in the CommandArgument property of the
LinkButton object.

This works
CommandArgument='<%#DataBinder.Eval(Container.Data Item, "Arg1")%>'

but this does not work
CommandArgument='<%#DataBinder.Eval(Container.Data Item,
"Arg1")%>,<%#DataBinder.Eval(Container.DataIte m, "Arg2")%>'

neither does this
CommandArgument='<%#DataBinder.Eval(Container.Data Item, "Arg1")%> &
<%#DataBinder.Eval(Container.DataItem, "Arg2")%>'

What's the syntax for this?

Thanks!

Mar 28 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
I figured it out how to achieve this. I use

CommandArgument='<%# SetUpArguments(DataBinder.Eval(Container.DataItem,
"SystemBillToCode"), DataBinder.Eval(Container.DataItem,
"NotifDate"))%>'

Function SetUpArguments(arg1 as string, arg2 as string) As String
SetUpArguments = arg1 & arg2
End Function

If you know the trick without a helper function, I'd still like to
know.

sy********@gmail.com wrote:
Hi,

I want to assign two data values in the CommandArgument property of the
LinkButton object.

This works
CommandArgument='<%#DataBinder.Eval(Container.Data Item, "Arg1")%>'

but this does not work
CommandArgument='<%#DataBinder.Eval(Container.Data Item,
"Arg1")%>,<%#DataBinder.Eval(Container.DataIte m, "Arg2")%>'

neither does this
CommandArgument='<%#DataBinder.Eval(Container.Data Item, "Arg1")%> &
<%#DataBinder.Eval(Container.DataItem, "Arg2")%>'

What's the syntax for this?

Thanks!


Mar 28 '06 #2

P: n/a
If you want to databind with more complicated logic than "insert field
a into slot b" you should look at the events that your templated
control fires. Look at the OnItemDataBound event.

You mentioned in another thread that you didn't want to hook into the
event, any particular reason? The code will be a lot less hairy if you
do things that way, even if it feels less intuitive.

Mar 28 '06 #3

P: n/a
Does

CommandArgument='<%# DataBinder.Eval(Container.DataItem, "SystemBillToCode")
& DataBinder.Eval(Container.DataItem, "NotifDate"))%>'

work?

Benjamin Strackany
www.developmentnow.com
<sy********@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
I figured it out how to achieve this. I use

CommandArgument='<%# SetUpArguments(DataBinder.Eval(Container.DataItem,
"SystemBillToCode"), DataBinder.Eval(Container.DataItem,
"NotifDate"))%>'

Function SetUpArguments(arg1 as string, arg2 as string) As String
SetUpArguments = arg1 & arg2
End Function

If you know the trick without a helper function, I'd still like to
know.

sy********@gmail.com wrote:
Hi,

I want to assign two data values in the CommandArgument property of the
LinkButton object.

This works
CommandArgument='<%#DataBinder.Eval(Container.Data Item, "Arg1")%>'

but this does not work
CommandArgument='<%#DataBinder.Eval(Container.Data Item,
"Arg1")%>,<%#DataBinder.Eval(Container.DataIte m, "Arg2")%>'

neither does this
CommandArgument='<%#DataBinder.Eval(Container.Data Item, "Arg1")%> &
<%#DataBinder.Eval(Container.DataItem, "Arg2")%>'

What's the syntax for this?

Thanks!

Mar 29 '06 #4

P: n/a
This did not work and after a careful examination "under the hood" of
how Databinding works, I discovered ultimately the "DataBinder.Eval()
get passed into a ConvertToString(). I believe this is the function it
used when I looked the page at compiled time. That's how I came to the
idea of setting up a helper/wrapper. Another easy option would be
to have this done in Sqlserver.

Someone asked why I didn't put this in my ItemDataBound event?
Originally that's how I had it. I just didn't like the fact I had to
search for my LinkButton webserver control
and after I found it, then assign the value to the properties. Which
is faster? Depends how you look at it and many other factors.

Sydney
Benjamin Strackany wrote:
Does

CommandArgument='<%# DataBinder.Eval(Container.DataItem, "SystemBillToCode")
& DataBinder.Eval(Container.DataItem, "NotifDate"))%>'

work?

Benjamin Strackany
www.developmentnow.com
<sy********@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
I figured it out how to achieve this. I use

CommandArgument='<%# SetUpArguments(DataBinder.Eval(Container.DataItem,
"SystemBillToCode"), DataBinder.Eval(Container.DataItem,
"NotifDate"))%>'

Function SetUpArguments(arg1 as string, arg2 as string) As String
SetUpArguments = arg1 & arg2
End Function

If you know the trick without a helper function, I'd still like to
know.

sy********@gmail.com wrote:
Hi,

I want to assign two data values in the CommandArgument property of the
LinkButton object.

This works
CommandArgument='<%#DataBinder.Eval(Container.Data Item, "Arg1")%>'

but this does not work
CommandArgument='<%#DataBinder.Eval(Container.Data Item,
"Arg1")%>,<%#DataBinder.Eval(Container.DataIte m, "Arg2")%>'

neither does this
CommandArgument='<%#DataBinder.Eval(Container.Data Item, "Arg1")%> &
<%#DataBinder.Eval(Container.DataItem, "Arg2")%>'

What's the syntax for this?

Thanks!


Mar 29 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.