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>
精彩评论