EDN Admin
Well-known member
<img alt="" src="http://social.msdn.microsoft.com/Forums/getfile/112118 <br/>
this code is not wo r king , can help me see this code need to add somethings? because my problem is how to check the id available or not in xml file<br/>
protected void Button3_Click(object sender, EventArgs e)<br/>
{<br/>
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();<br/>
doc.Load(Server.MapPath("Inventory.xml"));<br/>
<br/>
<br/>
if (TextBox1.Text.Equals(""))<br/>
{<br/>
Label1.Visible = true;<br/>
Label1.Text = "Please write Id";<br/>
return;<br/>
}<br/>
else<br/>
{<br/>
}<br/>
if (!System.IO.File.Exists(Server.MapPath(TextBox1.Text + "Inventory.xml")))<br/>
{<br/>
Label1.Visible = true;<br/>
Label1.Text = "ID available";<br/>
return;<br/>
}<br/>
else<br/>
{<br/>
Label1.Visible = true;<br/>
Label1.Text = "ID used, please rewrite";<br/>
TextBox1.Text = "";<br/>
return;<br/>
<br/>
}<br/>
}<br/>
my xml file
<products><br/>
<cloths id="A01 <br/>
<clothName>Polo Shirt</clothName><br/>
<Size>S</Size><br/>
<Price>50.99</Price><br/>
<Amount>100000</Amount><br/>
<images>Image/shirt1.png</images><br/>
</cloths><br/>
<cloths id="A02 <br/>
<clothName>Polo Shirt</clothName><br/>
<Size>M</Size><br/>
<Price>50.99</Price><br/>
<Amount>100000</Amount><br/>
<images>Image/shirt1.png</images><br/>
</cloths><br/>
<cloths id="A03 <br/>
<clothName>Polo Shirt</clothName><br/>
<Size>XL</Size><br/>
<Price>50.99</Price><br/>
<Amount>100000</Amount><br/>
<images>Image/shirt1.png</images><br/>
</cloths>
</products>
<br/>
View the full article
this code is not wo r king , can help me see this code need to add somethings? because my problem is how to check the id available or not in xml file<br/>
protected void Button3_Click(object sender, EventArgs e)<br/>
{<br/>
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();<br/>
doc.Load(Server.MapPath("Inventory.xml"));<br/>
<br/>
<br/>
if (TextBox1.Text.Equals(""))<br/>
{<br/>
Label1.Visible = true;<br/>
Label1.Text = "Please write Id";<br/>
return;<br/>
}<br/>
else<br/>
{<br/>
}<br/>
if (!System.IO.File.Exists(Server.MapPath(TextBox1.Text + "Inventory.xml")))<br/>
{<br/>
Label1.Visible = true;<br/>
Label1.Text = "ID available";<br/>
return;<br/>
}<br/>
else<br/>
{<br/>
Label1.Visible = true;<br/>
Label1.Text = "ID used, please rewrite";<br/>
TextBox1.Text = "";<br/>
return;<br/>
<br/>
}<br/>
}<br/>
my xml file
<products><br/>
<cloths id="A01 <br/>
<clothName>Polo Shirt</clothName><br/>
<Size>S</Size><br/>
<Price>50.99</Price><br/>
<Amount>100000</Amount><br/>
<images>Image/shirt1.png</images><br/>
</cloths><br/>
<cloths id="A02 <br/>
<clothName>Polo Shirt</clothName><br/>
<Size>M</Size><br/>
<Price>50.99</Price><br/>
<Amount>100000</Amount><br/>
<images>Image/shirt1.png</images><br/>
</cloths><br/>
<cloths id="A03 <br/>
<clothName>Polo Shirt</clothName><br/>
<Size>XL</Size><br/>
<Price>50.99</Price><br/>
<Amount>100000</Amount><br/>
<images>Image/shirt1.png</images><br/>
</cloths>
</products>
<br/>
View the full article