Jump to content
Xtreme .Net Talk

Recommended Posts

  • Moderators
Posted

Create a Public function and call it like this.. (you can do the same thing with public variables as well)

 

<% =myFunction()%>

 

'code-behind
Public function myFunction() as string
   return "some value"
end function

Visit...Bassic Software
Posted

Hi...this is how I am trying to call the function in the code-behind:

 

<asp:TemplateColumn HeaderStyle-Width="150px" SortExpression="name" HeaderText="Bar" ItemStyle-BackColor="BlanchedAlmond">

<ItemTemplate>

<asp:HyperLink Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"name")%>' NavigateUrl='<%# "/GB.Web/BarOwner/BarProfile.aspx?id=" & =StringOperations.Encrypt(DataBinder.Eval(Container.DataItem,"idNum"))%>'>

</asp:HyperLink>

</ItemTemplate>

</asp:TemplateColumn>

 

And I am getting this error:

 

BC30516: Overload resolution failed because no accessible 'ToString' accepts this number of arguments.

 

 

Can u tell me whats wrong...

 

The StringOperations is a class where the Encrypt() is a shared function which takes an integer and returns a string

 

SJ

  • Moderators
Posted

A couple of " and & were miss-placed

 

<asp:HyperLink Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"name")%>'

NavigateUrl='/GB.Web/BarOwner/BarProfile.aspx?id=<%# =myFunction(DataBinder.Eval(Container.DataItem,"idNum"))%>'

ID="Hyperlink1" NAME="Hyperlink1">

Visit...Bassic Software
Posted

Now...it is not giving me any error but whatever is in the asp tags is being displayed as string!!!!

 

Like this---

 

Profile.aspx?id=<%# =Encrypt(DataBinder.Eval(Container.DataItem,"idNum"))%>

  • Moderators
Posted

Did you paste exactly this ... It does work for me as is.

 

<asp:HyperLink Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"name")%>' 
NavigateUrl='/GB.Web/BarOwner/BarProfile.aspx?id=<%# myFunction(Container.DataItem("idNum"))%>' 
ID="Hyperlink1" ></asp:HyperLink>

Visit...Bassic Software
Posted

this is what I have ....

 

<asp:HyperLink Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"name")%>' NavigateUrl='/GB.Web/BarOwner/BarProfile.aspx?id=<%# Encrypt(DataBinder.Eval(Container.DataItem,"idNum"))%>' >

</asp:HyperLink>

 

I even tried with the '=' sign before the Encrypt() function like this

 

<asp:HyperLink Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"name")%>' NavigateUrl='/GB.Web/BarOwner/BarProfile.aspx?id=<%# =Encrypt(DataBinder.Eval(Container.DataItem,"idNum"))%>' >

</asp:HyperLink>

 

Its not working..still showing the string!!!!

Posted

Bad news!!!

 

I am sorry about the last one...I tried like this now...

 

<asp:HyperLink Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"name")%>' NavigateUrl='/GB.Web/BarOwner/BarProfile.aspx?id=<%# Encrypt(Container.DataItem("idNum"))%>' >

</asp:HyperLink>

 

Not working!!!!

 

By the way...I forgot to ask u....the MyFunction() function u are trying, is it in the code-behind or did u write that function in the HTML page itself?

 

SJ

Posted

Hi..I appreciate ur patience....but i am sorry that i didn't find any difference between ur code and mine...except the way u closed the tags...i tried that too but it just doesn't work.

 

SJ

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...