Click here to Skip to main content
14,733,542 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have this code:

$(document).ready(function () {


        $('#priroda_').click(function () {


        $('#znamenitosti_').click(function () {

 <div class="meni">
    <li class="active"><a href="#">Info</a></li>
    <li><a href="#" id="znamenitosti_">Znamenitosti</a></li>
    <li><a href="#" id="priroda_">Priroda</a></li>
    <li><a href="#" id="nokenzivot_">Noken Zivot</a></li>

where I have few categories in the menu. When i click on specific category, i want to show the (div) tag for that specific category within the same .aspx page, and the other (div) tags for the other categories should be hidden. This is the (div) tag for the category "Priroda":

<div class="Priroda" id="Priroda">
         <asp:DataList ID="DataList1" runat="server" RepeatColumns="7" CellPadding="3">
<div class="boxButton">
<ul class="Gallery">
<li><a id="A1"  href='<%# Eval("ime","~/Sliki/Ohrid/Priroda/{0}") %>' title='<%# "Од "+ Eval("userid")+ ", на " +  Eval("datum")+ ", " +  Eval("opis")%>'  rel="FaceBox[gallery1]"  runat="server" >
 <asp:Image ID="Image1"  ImageUrl='<%# Bind("ime", "~/Sliki/Ohrid/Priroda/{0}") %>' runat="server" Width="140" Height="140" AlternateText='<%# Bind("imeslika") %>' />

For binding the DataList i used this code in .cs file:

protected void BindDataList1()
    String strConnString = System.Configuration.ConfigurationManager
    SqlConnection con = new SqlConnection(strConnString);
    //Query to get ImagesName and Description from database
    SqlCommand command = new SqlCommand("SELECT ime, imeslika, kategorija, datum, opis, slikapateka, userid FROM Ohrid WHERE kategorija='Priroda'", con);
    SqlDataAdapter da = new SqlDataAdapter(command);
    DataTable dt = new DataTable();
    dlImages.DataSource = dt;

Now i don't know how to call BindDataList1(); to show me data when i click on that category. I have different BindDataLists for each category. Can you tell me how to call specific BindDataList for the category that is selected from the menu? For example when i click on link Priroda show me the (div) tag Priroda and BindDalaList1();, when i click on link Znamenitosti show me the (div) tag Znamenitosti and BindDalaList2();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900