calling public shared function from a datagrid template column

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.
 
K

Karl Seguin

Sure. Just call it!

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

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

Karl
 
H

hansiman

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>
 
H

hansiman

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

Top