0

I'm currently converting my WSPs application into WAPs for security purpose. but I got some issue, I can't call the Public function on aspx source in WAPs, on WSPs aspx source and WAPs codebehind there's no issue.

Here's the function ;

namespace WAUGHI
 {
public static class PublicVar
{
    public static string Expurgate(this string TargetStr, int MaxLenght)
    {
     if (TargetStr.ToCharArray().Count() > MaxLenght)
        {
            return TargetStr.Substring(0, MaxLenght) + "...";
        }
        else return TargetStr;
    }
 }  }

the function cut the string if the string exceed the limit on define length.

calling the function like this on aspx source

Text='<%# DataBinder.Eval(Container, "DataItem.Categories").ToString().Expurgate(24) %>'

e.g.

string = "Hung Hang is not chinese, guess?"

the output is "Hung Hang is not chinese..."

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Ching Chang Chung
  • 215
  • 1
  • 5
  • 14

1 Answers1

0

You are using an extension method (Expurgate) over a string type.

Be sure that your namespace WAUGHI is accessible from your page.

Take a look at this question

Community
  • 1
  • 1
polkduran
  • 2,533
  • 24
  • 34