如何动态更改资源文件中的键值 [英] How Do I Make Change Key Values In Resource File Dynamically
问题描述
我想动态更改资源文件的标签文本
使用以下代码....
m通过项目索引更改值但不更改正确的指数......
请帮帮我...
给我解决方案..
public string文件名;
filename =ProductCollection.aspx.resx;
filename = Request.PhysicalApplicationPath +App_LocalResources \\+ filename;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(filename);
XmlNodeList nlist = xmlDoc.GetElementsByTagName(data );
XmlNode childnode = nlist.Item(33);
childnode.Attributes [xml:space]。Value =default;
xmlDoc.Save(filename);
XmlNode lastnode = childnode.Se lectSingleNode(value);
lastnode.InnerText =COLLECTIONS;
xmlDoc.Save(filename);
filename =ProductCollection.aspx.it.resx;
filename = Request.PhysicalApplicationPath +App_LocalResources\\+ filename;
XmlDocument xmlDoc1 = new XmlDocument();
xmlDoc1.Load(filename);
XmlNodeList nlist1 = xmlDoc1.GetElementsByTagName(data);
XmlNode childnode1 = nlist1.Item(33);
childnode1.Attributes [xml:space]。Value =default;
xmlDoc1.Save(filename);
XmlNode lastnode1 = childnode1.SelectSingleNode(value);
lastnode1.InnerText =COLLEZIONI;
xmlDoc1.Save(filename);
I Want to change the Text of label of resource file Dynamically
Using below code....
m changing the value through item index but it does not changing the correct index...
Please Help me...
Give me solution..
public string filename;
filename = "ProductCollection.aspx.resx";
filename = Request.PhysicalApplicationPath + "App_LocalResources\\" + filename;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(filename);
XmlNodeList nlist = xmlDoc.GetElementsByTagName("data");
XmlNode childnode = nlist.Item(33);
childnode.Attributes["xml:space"].Value = "default";
xmlDoc.Save(filename);
XmlNode lastnode = childnode.SelectSingleNode("value");
lastnode.InnerText = "COLLECTIONS";
xmlDoc.Save(filename);
filename = "ProductCollection.aspx.it.resx";
filename = Request.PhysicalApplicationPath + "App_LocalResources\\" + filename;
XmlDocument xmlDoc1 = new XmlDocument();
xmlDoc1.Load(filename);
XmlNodeList nlist1 = xmlDoc1.GetElementsByTagName("data");
XmlNode childnode1 = nlist1.Item(33);
childnode1.Attributes["xml:space"].Value = "default";
xmlDoc1.Save(filename);
XmlNode lastnode1 = childnode1.SelectSingleNode("value");
lastnode1.InnerText = "COLLEZIONI";
xmlDoc1.Save(filename);
推荐答案
这篇关于如何动态更改资源文件中的键值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!