在位置搜索中拆分文本框值 [英] Split the textbox values in location search

查看:51
本文介绍了在位置搜索中拆分文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


这是我的位置表列表

钦奈,孟买,浦那
孟买金奈
孟买,科钦
德里,班加罗尔
chennai
钦奈班加罗尔

例如:Naukri,Monster Jobportal网站中的位置搜索类别


如果要提供chennai的输入值,则孟买意味着我要在此数据列表中列出chennai和孟买的列表值.

我正在使用此编码路径,请检查

我已经使用了编码路径,但是没有输出.我发送了我的编码,请检查编码,如果错误意味着请更改编码,然后将其发送给我,先生

在asp.net中进行编码

Hi
This''s my Location table list

chennai, mumbai, pune
chennai, mumbai
mumbai, cochin
del 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

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 + ")");
}
}





巴拉

[edit]已添加代码块-OriginalGriff [/edit]



by

Bala

[edit]Code block added - OriginalGriff[/edit]

推荐答案

嗨 您已将"ghmultiple"声明为字符串.这不是一个数组.但是,您正在根据索引位置检索数据.尝试将其替换为字符串数组,或者从ghmultiple中获取当前值而不使用索引位置.
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.


这篇关于在位置搜索中拆分文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆