是否可以从代码隐藏写入本地资源文件?
我在 asp.net 中创建了一个用户控件,并将其用作 Sitefinity 控件。我已启用本地化,并且有两个本地资源文件,一个默认语言和另一种语言。在 Sitefinity 中,当您将控件拖放到页面上时,您可以选择通过 Sitefinity 编辑内容和标签。我希望这些值来自本地资源文件,并且我还希望能够将这些值写入/编辑到资源文件中。
我的标签之一在后面的代码中看起来像这样(这是在 C# 中):
[Category("Username Configuration")]
public string UsernameText
{
get
{
return this.GetLocalResourceObject("UsernameText");
}
set
{
??? = value;
}
}
因此,当您编辑控件并调出配置工具时,在“用户名配置”类别下,将有一个从本地资源检索的字符串,但我不确定如何(如果可能的话)将值写入 .resx 文件。
I've made a user control in asp.net and it's being used as a Sitefinity control. I've enabled localization and I have two local resource files, one default and another language. In Sitefinity when you drop a control onto the page you have the option of editing content and tags through Sitefinity. I want these values to come from the local resource file and I want to also be able to write/edit these values to the resource file.
One of my tags looks like this in the code behind (This is in C#):
[Category("Username Configuration")]
public string UsernameText
{
get
{
return this.GetLocalResourceObject("UsernameText");
}
set
{
??? = value;
}
}
So when you edit the control and it brings up the config tool, under the category Username Configuration, there will be a string that was retrieved from the local resource, but I'm not sure how to (if at all possible) write a value to the .resx file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它可能会有所帮助 http: //kishor-naik-dotnet.blogspot.com/2010/09/cnet-read-and-write-into-resx-file.html
It may help http://kishor-naik-dotnet.blogspot.com/2010/09/cnet-read-and-write-into-resx-file.html