Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Trying to find out how to do a search that is not case-sensitive, I found the following code:

 

<?xml version="1.0" encoding="utf-8"?>
<Users>
 <User>
   <Name>sonu</Name>
   <Password>sonu</Password>
 </User>
</Users>
</code>
Code File:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<%@ Page Language="C#" Debug="true" %>

<script  runat="server">
void Page_Load(object sender, System.EventArgs e){
   if(!Page.IsPostBack){
       XmlDocument xmlDoc = new XmlDocument();
       xmlDoc.Load(Server.MapPath("user.xml"));

XmlNodeList nodeList = xmlDoc.SelectNodes("Users/User[Name = translate
('SONU', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]");

Response.Write(nodeList.Count.ToString());
   }
}
</script>

 

http://www.devx.com/DevX/Tip/21293

 

This works, except if you capitalize the first letter: Sonu, instead of the lower-case sonu, in the XML file

 

Anyone familiar with the translate function?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...