使用Ajax Textbox控件搜索........................... [英] Search Using Ajax Textbox control...........................

查看:72
本文介绍了使用Ajax Textbox控件搜索...........................的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,



我有一个ajax文本框和按钮,可以从gridview中搜索记录。





我的数据库中共有6列(Sql 2005),我需要搜索所有6个字段



例如我有学生,学生姓名,父亲姓名,DOJ,课程,HTNo,



现在我需要搜索这些学生,学生姓名,父亲姓名,doj,HTNo,课程的所有字段。



这些字段应该在文本框中显示为水印



无法解决此问题,因为从一周我正在尝试这个。请帮助我。



谢谢,

解决方案

在gridview中使用带有ajax水印的文章框

喜欢



 <  < span class =code-leadattribute> templatefileld  >  
< itemtemplate >
< asp:textbox id = 学生 runat = server xmlns:asp = #unknown / < span class =code-keyword>>
< cc1:textboxwatermark id = water runat = server xmlns:cc1 = #unknown >
TargetControlID =StudentidWaterMarkText =学生ID/>
< / cc1:textboxwatermark > < / itemtemplate >





代码可能包含语法错误但逻辑清晰


你可以获得源代码将网格划分为如下数据表:

 DataTable dt =(DataTable)myGrid.DataSource; 





并且可以使用dt.Select()根据您的需要根据用户输入提供过滤器,例如:



 DataRow [] rows = dt.Select(Studentid like \'%+ txtSearch.Text +%\'或StudentName like \'%+ txtSearch.Text +%\'或像Fathername \'%+ txtSearch.Text +%\'或doj喜欢\'%+ txtSearch.Text +%\'或HTNo喜欢\'%+ txtSearch.Text +%\ '或者像\'%'+ t的课程xtSearch.Text +%\'); 





问候,

Akaas Developer


Dear All,

I have a ajax textbox and button to search the records from gridview.


I have total 6 columns in my database(Sql 2005) from this i need to search all 6 fields

For Example I have Studentid, StudentName,FatherName, DOJ, Course, HTNo,

Now i need to search all fields from these Studentid,StudentName,Fathername,doj,HTNo,Course.

These fields should be displayed in Textbox as watermark

Am unable to solve this problem , since from one week am trying this. Please help me.

THANKS,

解决方案

Dear use template field in gridview with ajax water mark Textbox
like

<templatefileld>
<itemtemplate>
<asp:textbox id="Studentid" runat="server" xmlns:asp="#unknown" />
<cc1:textboxwatermark id="water"  runat="server" xmlns:cc1="#unknown">
TargetControlID="Studentid" WaterMarkText="Student ID"/>
</cc1:textboxwatermark></itemtemplate>



code may contain syntax error but the logic is clear


you can get source of grid into a data table like:

DataTable dt = (DataTable)myGrid.DataSource;



and can use dt.Select() by providing filter according to your needs based on user input like:

DataRow[] rows = dt.Select("Studentid like \'%" + txtSearch.Text + "%\' or StudentName like \'%" + txtSearch.Text + "%\' or Fathername like \'%" + txtSearch.Text + "%\' or doj like \'%" + txtSearch.Text + "%\' or HTNo like \'%" + txtSearch.Text + "%\' or Course like \'%" + txtSearch.Text + "%\'");



Regards,
Akaas Developer


这篇关于使用Ajax Textbox控件搜索...........................的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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