Appframe Knowledge Base


1 hits
0

Search a record source using a query parameter and output html for each row in razor

@{
	var vRecordSource = RecordSource("aviw_Some_View");
	string vSearch = @QueryString.RawValue("query");
	vRecordSource.SelectColumns.Add("Column1");
	if(vSearch != null && vSearch != ""){
		vRecordSource.WhereClause = "SearchColumn LIKE '%" + vSearch.Replace("'", "''") + "%'";
	}
	vRecordSource.OrderByColumns.Add("Column1",eDescAsc.Asc);
	vRecordSource.MaxRecords = -1;
	var vData = vRecordSource.GetData();
}
@if(vData.Count > 0){
	<ul>
	@foreach (var vRow in vData)
	{
		<li>@HtmlEncode(vRow["Column1"].ToString())</li>
	}
	</ul>
}

razor web · Perma link post comment Posted by: Peter Øren (15-jan-2013)