【发布时间】:2018-01-19 10:24:45
【问题描述】:
我有一个简单的页面,其中转发器由 c# 数据绑定方法填充。该页面有一个搜索文本框,我想在您键入时进行搜索。这通过 databind 方法中的 rowfilter 起作用,通过 searchtextbox 中的内容进行过滤。
我在每个按键上触发 jquery,但希望它在每个按键上运行我的 c# 数据绑定方法。我该怎么做?
数据绑定方法
protected void DataBindVideosRepeaterList()
{
DataView dv = (DataView)IRPAdminHelpTopicVideoDB.GetAllVideos();
dv.RowFilter = this.GetVideosFilter();
this.RptVideos.DataSource = dv;
this.RptVideos.DataBind();
}
行过滤方法
protected string GetVideosFilter()
{
string filterCriteria = "";
if (!string.IsNullOrEmpty(this.TxtVideoSearch.Text))
{
filterCriteria = " Tags LIKE '%" + this.TxtVideoSearch.Text + "%'";
}
return filterCriteria;
}
jQuery
<script type="text/javascript">
$("#TxtVideoSearch").keypress(function () {
/** I WANT THE DataBindVideosRepeaterList() METHOD TO RUN HERE **/
});
</script>
【问题讨论】:
标签: javascript c# jquery asp.net data-binding