c# - Attribute is not updating using LINQ TO XML? -


i load xml file xelement. an element named r via:

xelement elem = xmltemplate.descendants().where(x => x.name.localname == "r").firstordefault(); 

i search attributes ef , ex via:

elem.attribute("ef").setvalue(txteffective.text); elem.attribute("ex").setvalue(txtexpire.text); 

but when call xtemplate.save(...), not save udpated attributes. have tried:

elem.attribute("ef").value = txteffective.text; elem.attribute("ex").value = txtexpire.text; 

i found out problem, not sure how avoid it. when load xml, loading 2 attributes in 2 text boxes on form. when change values in text box update attributes, updating xml original values in text box , not new ones. wonder if has fact text boxes loaded on page load , when click button, loads xml again , overwrites new values original values. after did not load values in text box, save worked fine.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -