Hi All
If there are any vb.net coders here I could really use some help on what should be something simple but is currently driving me crazy.
I have a .ascx User Control which I
am incorporating into a .aspx page.
In the .ascx user control file, I have an SQL statement, where I want to make use of a variable called KeyphraseText. It looks like this:
<%
.....
Dim Sql As String = "SELECT ..... WHERE KeyphraseText LIKE '" & KeyphraseText & "' AND ...... ;"
.....
%>
All I
am trying to achieve is to set this variable from a line in my .aspx file. Sounds easy right? Well, I seem to be struggling. So far, I have been advised that the best way to achieve this is to add a vb.net property to the .ascx file, which I have done as follows:
<script runat=server>
Public KeyphraseText As String
Public Property KeyphraseTextAssignment() As String
Get
Return KeyphraseText
End Get
Set(ByVal Value As String)
KeyphraseText = Value
End Set
End Property
</script>
I think the syntax for my property statement is correct, so all I need to do now is set the property value from my .aspx file. FYI the id of the user control is merchantsfromfilename, and I have the following user control statement in my .aspx file:
<navito:merchantsfromfilename id="merchantsfromfilename" runat="server" />
The .aspx file does actually make use of a code behind page, so into that I have added my attempted assignment of the property in my user control as follows:
merchantsfromfilename.KeyphraseTextAssignment = "mobile phones"
Currently this line is causing the compiler error:
Compiler Error Message: BC30188: Declaration expected.
Can people please come to the assistance of a very frustrated coder. Bearing in mind my simple objective, can anyone shed any light on this problem?
Thanks
Accelerator