Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Concatenating two databinding expressions - how??

Reply
Thread Tools

Concatenating two databinding expressions - how??

 
 
sydney.luu@gmail.com
Guest
Posts: n/a
 
      03-28-2006
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!

 
Reply With Quote
 
 
 
 
sydney.luu@gmail.com
Guest
Posts: n/a
 
      03-28-2006
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.



http://www.velocityreviews.com/forums/(E-Mail Removed) 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!


 
Reply With Quote
 
 
 
 
Flinky Wisty Pomm
Guest
Posts: n/a
 
      03-28-2006
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.

 
Reply With Quote
 
Benjamin Strackany
Guest
Posts: n/a
 
      03-29-2006
Does

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

work?

Benjamin Strackany
www.developmentnow.com


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.
>
>
>
> (E-Mail Removed) 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!

>



 
Reply With Quote
 
sydney.luu@gmail.com
Guest
Posts: n/a
 
      03-29-2006
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
>
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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.
> >
> >
> >
> > (E-Mail Removed) 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!

> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenating Date and Time from two differnt fields Tamer Ibrahim ASP .Net 1 01-17-2008 12:54 PM
Databinding expressions are only supported on objects that have a DataBinding event jobs ASP .Net 0 09-25-2007 11:54 PM
Help W/Concatenating Localization Expressions Rusty Hill ASP .Net 0 04-30-2007 10:24 PM
Concatenating two literals... TheCoder@cpp.com C++ 3 03-02-2007 08:35 AM
Gridview encoding, or how to run commands before gridview's default databinding, or, how do I disable default databinding at all? Sergei Shelukhin ASP .Net 1 11-12-2006 01:43 PM



Advertisments