Use DataBind item in script

Results 1 to 2 of 2

Thread: Use DataBind item in script

  1. #1
    Join Date
    Dec 1969

    Default Use DataBind item in script

    I use code behind to databind some data to a Repeater control. How can I use one of these values in script something like this?<BR><BR>&#060;%<BR>If x = Container.DataItem("value") Then<BR> Response.Write("Value exists")<BR>End If<BR>%&#062;<BR><BR>Obviously, this doesn&#039;t work. I can put &#060;%# Container.DataItem("value") %&#062; in the HTML and it works fine, but what I want to do is use it in the script to decide what HTML to show. Thanks.

  2. #2
    Join Date
    Dec 1969

    Default use a function

    In the code:<BR><BR>[code language="VB.NET"]Public Function WriteValueExits(i_Value) As String<BR> Dim RetVal As String = ""<BR> If x = i_Value then RetVal = "Value Exists"<BR> Return RetVal<BR>End Function[/code]<BR><BR>In the repeater:<BR><BR>[code language="VB.NET"]&#060;%# Container.DataItem("value") %&#062;[/code]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts