Click here to Skip to main content
16,006,475 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I populate a dropdown list and textbox with the matched strings? I have an array consisting for few characters and a normal string.
I have used the following but how can I use the matched strings to populate textboxes?

Here is the code which I have used:
C#
var populatedata = document.getElementById("<%=txtparse.ClientID %>").value;
  var newdata = new Array();
  newdata = populatedata.split('when');
  for (var i = 0; i < newdata.length; i++) {
      var sign = ["AND", "<", ">", ">=", "<=", "then",' '];
      for (var j = 0; j <= sign.length; j++) {
          var match = newdata[i].match(sign[j]);


txtparse is the ASP.net ID of the textbox which contains the string. Taking the string from this textbox based on matching strings with sign array I have to populate textbox.
:confused: :sigh:

Kindly help me out.
Posted
Updated 12-Dec-10 1:25am
v3
Comments
[no name] 10-Dec-10 9:28am    
"txtparse is the ID..." I don't see this in the code snippet, are you missing something?
badprog 10-Dec-10 15:48pm    
Was he referring to the txtparse in the getElementById function?
Keith Barrow 12-Dec-10 7:23am    
document.getElementById("<%=txtparse.ClientID %>").value; is just getting value an *ASP.NET* control called txtparse on the client in JavaScript (ClientID is the ID of the control rendered), it isn't hugely relevant unless this code isn't working :-)
Keith Barrow 12-Dec-10 7:28am    
@Manu17 I can't see what your problem is other than this
var match = newdata[i].match(sign[j]);
just sets the matched variable, and does nothing with it.Can you state what is happening and what you expect.

1 solution

sorry for inconvenience guys..well i got the answer.thanks for your support.Actually i was trying this in javascript but c sharp coding was much easier..Sorry again ..:thumbsup:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900