1

I have no idea what is happening here, this code works and nothing wrong with it, then suddenly it gives the mentioned error with no reasons and then the error disappears. the error is in the line '>

<asp:SqlDataSource ID="SqlDataSourceCountries" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices1 %>"
                SelectCommand="SELECT        [CountryID], [country],
                         (SELECT        COUNT(JobID) AS [J]
                            FROM            [Job]
                            WHERE        ([Country].[CountryID] = [CountryID])) AS [JobCount]
                            FROM            [Country] AS [Country] ORDER BY [JobCount] DESC, [country] ASC">
            </asp:SqlDataSource>

            <script type="text/javascript">
                $(document).ready(function () {
                    $("ul[id*=myid] li").click(function () {

                        document.getElementById("<%= DivCountries.ClientID %>").style.visibility = 'hidden';

                        document.getElementById('pSelectedCountry').innerHTML = $(this).html();
                        $("#<%=hSelectedCountryID.ClientID%>").val(this.id);
                        $("#<%=hSelectedCountryName.ClientID%>").val(this.innerHTML);
                        control1OnLoadHandler();

                    });
                });
            </script>
            <ul id='myid' class="bulletedList">
                <asp:Repeater ID="RepeaterCountryList" runat="server" DataSourceID="SqlDataSourceCountries">
                    <ItemTemplate>
                        <li id='<%# Eval("[CountryID]") %>'><a>
                            <%# Eval("[country]") %></a> <a style="color: #808080; font-weight: normal;">(<%# Eval("[JobCount]") %>)</a>
                        </li>
                    </ItemTemplate>
                </asp:Repeater>
            </ul>
Mohamed Usama
  • 99
  • 2
  • 13

2 Answers2

0

I think the problem is with the []'s.

Try something like this

<ItemTemplate>
 <li id='<%# Eval("CountryID") %>'>
 <a><%# Eval("[country]") %></a> <a style="color: #808080; font-weight: normal;">(<%# Eval("JobCount") %>)</a>
 </li>
</ItemTemplate>

And maybe change your query, as brackets aren't usually neccessary.

Also, it's confusing that your table name is country as well as the item you are selecting: SELECT ...[country]...FROM [Country] AS [Country]...

Community
  • 1
  • 1
Louis Waweru
  • 3,572
  • 10
  • 38
  • 53
0

You must Add the Primary Key Field of that particular table in the Select Query.

you can hide it later by using the visible at the end of Column.

<telerik:GridBoundColumn DataField="Subject" visible="false">

Balaji
  • 1,375
  • 1
  • 16
  • 30