Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
This's my Location table list

chennai, mumbai, pune
chennai, mumbai
mumbai, cochin
delhi, bangalore
chennai
bangalore, chennai

For examples : Naukri, Monster jobportal website in location search category


If am give the input values for chennai, mumbai means i want list out the chennai and mumbai list values in this datalist

I am using this coding path please check it

I already use the coding path but i didnt got output. I send my coding please check the coding if error means please alter the coding and send me sir

coding in asp.net

C#
string gh;
gh = lbllocat.Text.Trim();
StringBuilder sb = new StringBuilder();
if (gh != "" && gh != null)
{
    string srch = "";

    string[] ghsplit = gh.Split(',');
    for (int i = 0; i < ghsplit.Length; i++)
    {
       string ghmultiple = ghsplit[i];
        if (srch == "")
        {
//srch = ghmultiple.ToString();
srch = ghmultiple[i].ToString().Trim();
//srch = "@loCat like '%" + ghmultiple.Trim() + "%'";
 bind_KeysrchFunction(lblkey.Text.Trim(), srch.Trim(), lblsrhcat.Text.Trim(), lblsrhexp.Text.Trim(), lblminsal.Text.Trim(), lblmaxsal.Text.Trim(), lblcomp.Text.Trim(), lblrole.Text.Trim(), lblfresh.Text.Trim(), lblsort.Text.Trim(), lblrefsearch.Text.Trim());
 }
else
{
srch = srch + ',' +ghmultiple[i].ToString().Trim();
//srch = gh[i].ToString().Trim();
srch = srch + "or like '% ','" + ghmultiple.Trim() + "%'";
bind_KeysrchFunction(lblkey.Text.Trim(), srch.Trim(), lblsrhcat.Text.Trim(), lblsrhexp.Text.Trim(), lblminsal.Text.Trim(), lblmaxsal.Text.Trim(), lblcomp.Text.Trim(), lblrole.Text.Trim(), lblfresh.Text.Trim(), lblsort.Text.Trim(), lblrefsearch.Text.Trim());
}
}
if (srch != "")
{
    sb.Append("and(" + srch + ")");
}
}


by

Bala

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 16-Apr-12 23:06pm
v2
Comments
OriginalGriff 17-Apr-12 5:08am    
If you want us to read your code, it should at least compile. Since that hasn't been indented correctly by VS, there is a very good chance that it doesn't!
Compile it, auto format it, and paste it in so we can read it easily.
Use the "Improve question" widget to edit your question and provide better information.

1 solution

Hi You declared "ghmultiple" as a string.This is not an array.But you are retrieving data based on index position.Try to replace this as string array or take current value from ghmultiple without index postion.
 
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