I have written some code in VB.Net 2005 that allows a user to enter a search keyword into a textbox. If they then click a results button a datagrid is displayed listing all the matching results highlighting all instances of the keyword.
This works fine in VB.Net 2005, but I need to convert the code to C#.Net 2003. Having converted the code I get the following error when running the project:
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
---
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for 'HighlightDataGridTest.Web
Form3.High
light(stri
ng, string)' has some invalid arguments.
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
---
The HTML for the datagrid is:
<asp:datagrid id=dgResults runat="server" autogeneratecolumns="false
" datakeyfield="ApplicationI
D">
<columns>
<asp:boundcolumn datafield="ApplicationID" headertext="ID"></asp:boun
dcolumn>
<asp:templatecolumn>
<itemtemplate>
<%#Highlight(strSearchword
, DataBinder.Eval(Container.
DataItem, "Message"))%>
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
The problem seems to be focused on the Template part of the DataGrid. I have created a function called Highlight in the codebehind that has the correct parameters.
Does anyone know what the problem may be? Do I need to alter the HTML in someway when switching to .Net 2003?
Many thanks,
Start Free Trial