R
rn5a
An ASP.NET app retrieves 3 columns named Product, Category & Price from
a SQL Server 2005 DB table & displays them in a DataList. The headers
of these 3 columns in the DataList are Product, Category & Price
respectively.
I want to give users the option to sort the items in the DataList. All
the 3 columns can be sorted by clicking the headers which are
LinkButtons. To do this, I want to invoke a sub-routine named
SortDataList which expects a parameter (which is the column header) but
when I try to pass the parameter in this way
<script runat="server">
Sub SortDataList(ColumnName As String)
..........
..........
End Sub
</script>
<form runat="server">
<aspataList ID="dList1" runat="server">
<HeaderTemplate>
<table border=2>
<tr>
<th><asp:LinkButton ID="lnkProduct" OnClick="SortDataList('Product')"
Text="PRODUCT" runat="server"/></th>
<th><asp:LinkButton ID="lnkCategory" OnClick="SortDataList('Category')"
Text="CATEGORY" runat="server"/></th>
<th><asp:LinkButton ID="lnkPrice" OnClick="SortDataList('Price')"
Text="PRICE" runat="server"/></th>
</tr>
</HeaderTemplate>
...........
...........
</aspataList>
</form>
ASP.NET generates the
Expression expected.
error pointing to the first LinkButton code line. I tried other
combinations & permutations of single quotes & double quotes but
ASP.NET either generates the above error or the
Identifier expected.
error. Can't a sub-routine be invoked by passing a parameter in the way
I have shown above?
a SQL Server 2005 DB table & displays them in a DataList. The headers
of these 3 columns in the DataList are Product, Category & Price
respectively.
I want to give users the option to sort the items in the DataList. All
the 3 columns can be sorted by clicking the headers which are
LinkButtons. To do this, I want to invoke a sub-routine named
SortDataList which expects a parameter (which is the column header) but
when I try to pass the parameter in this way
<script runat="server">
Sub SortDataList(ColumnName As String)
..........
..........
End Sub
</script>
<form runat="server">
<aspataList ID="dList1" runat="server">
<HeaderTemplate>
<table border=2>
<tr>
<th><asp:LinkButton ID="lnkProduct" OnClick="SortDataList('Product')"
Text="PRODUCT" runat="server"/></th>
<th><asp:LinkButton ID="lnkCategory" OnClick="SortDataList('Category')"
Text="CATEGORY" runat="server"/></th>
<th><asp:LinkButton ID="lnkPrice" OnClick="SortDataList('Price')"
Text="PRICE" runat="server"/></th>
</tr>
</HeaderTemplate>
...........
...........
</aspataList>
</form>
ASP.NET generates the
Expression expected.
error pointing to the first LinkButton code line. I tried other
combinations & permutations of single quotes & double quotes but
ASP.NET either generates the above error or the
Identifier expected.
error. Can't a sub-routine be invoked by passing a parameter in the way
I have shown above?