开发者

Access UserControl Property From ascx file

I have a function that Localize the text of my control.

// code behind
lblName.Text = Localiza开发者_开发问答tion.GetLocalValue( "Updated" , this.Path );

and I know that i can call a function inside ascx file.

// ascx file
Text='<%#Global.Convert( (DateTime)(Eval("CreatedDate")) %>'

How can i Get Path Property in ascx file To call GetLocalValue ?


You just need to create public property Path in code behind:

public string LocalizedPath
{
  get
    {
      return Localization.GetLocalValue( "Updated" , this.Path);
    }
}

And than you can use it in .aspx:

<script type="text/javascript">
  alert('<%= LocalizedPath %>');
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜