Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Can you evaluate a databinding expression?

Reply
Thread Tools

Can you evaluate a databinding expression?

 
 
sydney.luu@gmail.com
Guest
Posts: n/a
 
      03-28-2006
Hello,

See part of the code shown below. I would like to know, without
hooking to an event
called ContentRepeater_ItemDataBound, is it possible to evaluate this
databinding expression
and based on the condition, create a LinkButton immediately follows
this data and before
this <TD> ends? Basically, how I can code it to say:

If DataBinder.Eval(Container.DataItem, "CreateLinkButton") = "Y" Then
<ASP:LinkButton ....................>
End If

Thanks for the help!
Sydney






<asp:Repeater id="ContentRepeater" runat="server"
EnableViewState="False"
OnItemDataBound="ContentRepeater_ItemDataBound">

<ItemTemplate>
<tr id="TableRow" runat="server" bgcolor="#FFFFFF">
<td> <%# DataBinder.Eval(Container.DataItem,
"CreateLinkButton") %></td>

 
Reply With Quote
 
 
 
 
Karl Seguin [MVP]
Guest
Posts: n/a
 
      03-28-2006
It's pretty safe to ignore my comment. Without knowing more about your
system, I can only guess. It just _seems_ like presentation rules (ie, show
this button or not) are being decided by something other than the
presentation layer. But that could be a totally inaccurate view.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


<> wrote in message
news: oups.com...
> Karl,
>
> This will work for me and thanks for your help.
>
> I am not sure if I understand your "side note". Please explain.
>
> -Sydney
>
>
> Karl Seguin [MVP] wrote:
>> Yes.
>>
>> There's no good reason NOT to hook into an event, but yes it's possible.
>> There are different ways, but:
>>
>> <asp:linkbutton id="whatever" runat="server" visible='<%#
>> DataBinder.Eval(Container.DataItem, "CreateLinkButton") = "Y" %>' />
>>
>> on a side note, if your data layer is concernnig itself with a column
>> named
>> "CreateLinkButton", I'd suggest your layers are bleeding into each other.
>>
>> Karl
>>
>> --
>> http://www.openmymind.net/
>> http://www.fuelindustries.com/
>>
>>
>> <> wrote in message
>> news: oups.com...
>> > Hello,
>> >
>> > See part of the code shown below. I would like to know, without
>> > hooking to an event
>> > called ContentRepeater_ItemDataBound, is it possible to evaluate this
>> > databinding expression
>> > and based on the condition, create a LinkButton immediately follows
>> > this data and before
>> > this <TD> ends? Basically, how I can code it to say:
>> >
>> > If DataBinder.Eval(Container.DataItem, "CreateLinkButton") = "Y" Then
>> > <ASP:LinkButton ....................>
>> > End If
>> >
>> > Thanks for the help!
>> > Sydney
>> >
>> >
>> >
>> >
>> >
>> >
>> > <asp:Repeater id="ContentRepeater" runat="server"
>> > EnableViewState="False"
>> > OnItemDataBound="ContentRepeater_ItemDataBound">
>> >
>> > <ItemTemplate>
>> > <tr id="TableRow" runat="server" bgcolor="#FFFFFF">
>> > <td> <%# DataBinder.Eval(Container.DataItem,
>> > "CreateLinkButton") %></td>
>> >

>



 
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
Databinding expressions are only supported on objects that have a DataBinding event jobs ASP .Net 0 09-25-2007 11:54 PM
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
Could you evaluate my encryption software? moshe_szweizer@yahoo.com Computer Security 1 03-07-2006 10:50 PM
DataGrid Custom Column Error when DataBinding "does not contain a definition for 'DataBinding'" Earl Teigrob ASP .Net Datagrid Control 1 03-01-2004 04:52 AM
Can't get a db value to evaluate to TRUE...why? darrel ASP .Net 8 02-11-2004 01:43 PM



Advertisments