calling public shared function from a datagrid template column

  • Thread starter Thread starter hansiman
  • Start date Start date
H

hansiman

isn't it possible to call a public shared function that resides in
another file directly from the datagrid html code?:

<asp:TemplateColumn HeaderText="Password">
<ItemTemplate>
<asp:Label runat="server"
Text='<%# DecryptString(DataBinder.Eval(Container,
"DataItem.Password")) %>' />
</ItemTemplate>

Currently I have a DecryptString in the code behind the datagrid. This
function simply calls the same public shared function.
 
Sure. Just call it!

You'll need to specify the namespace and class like normal:

<%# Utility.DecryptString(...) %>

Karl
 
I tried this and it gives me the following error

Compiler Error Message: BC30451: Name 'Utility' is not declared.

Source Error:


Line 71: <asp:TemplateColumn HeaderText="Password">
Line 72: <ItemTemplate>
Line 73: <asp:Label runat="server" Text='<%#
Utility.DecryptString(DataBinder.Eval(Container, "DataItem.Password"))
%>' />
Line 74: </ItemTemplate>
Line 75: <EditItemTemplate>
 
Is utility the actual name of the class?

Is it in the same namespace as the page? If not, you need to qualify the
class name either via an @Import or via
SomeNamespace.Utility.DecryptString...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
thanks.

I wasn't aware that I could include
<%@ Import Namespace="
directly in the html file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top