I have a datalist, and by clicking it, the whole database records pop up. What I want to do is, which ever record is clicked ONLY that record should pop up.
This is my code for the data list and the pop up of all records.

.MY_POPUP_INNER_SMALL {
    background: none repeat scroll 0 0 #FFFFFF;
    border: 4px solid #ccc;
    border-radius: 3px 3px 3px 3px;
   display:none;
    left: 50%;
    margin-left: -302px;
    position: fixed;
    top: 5%;
    width: 500px;
    z-index: 1002;height:500px; overflow:auto;
}

        .cursor {
            cursor:pointer;

        }

         .MY_POPUP_BG
            {width: 100%;
        height: 100%;
                border-top: solid 1px #ccc;
                border-left: solid 1px #ccc;
                border-right: outset 1px #ccc;
                border-bottom: outset 1px #ccc;
                text-align: center;
                vertical-align: middle;
                padding-top: 30px;
                padding-bottom:30px;
                top: 0px;
                background-color: black;
        z-index:1001;
        -moz-opacity: 0.8;
        opacity:.80;
        filter: alpha(opacity=80);
        display:none;
            }    
    </style>
       <script>


        function func(x) {


            document.getElementById('pmInnerfeedback').style.display = 'block';
            document.getElementById('pmOuterfeedback').style.display = 'block';
            document.getElementById('ctl00_hdnfeedback').value = '1';

            return false;
        }

    </script>

This is the Data List

        <ul id="promobox">
    <li>
      <a href="Events.aspx"><h3>Events</h3></a>
      <ul>
        <asp:DataList ID="DataList4" runat="server" ClientIDMode="Static" DataSourceID="SqlDataSource4" style="margin-left: 0%" Width="271px">

              <ItemTemplate>

                  <a onclick="func()" class="cursor" style="background-color:none; text-align:left;"><asp:Label ID="Label4" runat="server" Text='<%# Eval("EventName") %>'></asp:Label></a>
              </ItemTemplate>

          </asp:DataList>

       <asp:SqlDataSource
          id="SqlDataSource4"
          runat="server"
          DataSourceMode="DataReader"
          ConnectionString="<%$ ConnectionStrings:SEConn%>"
          SelectCommand=" SELECT TOP 5 EventName FROM Event;">
      </asp:SqlDataSource>
      </ul>

I've tried doing a lot of stuff, like i tried to get the ID from the record clicked like this: var m = $(this).parent().prev().text(); To check that I tried an alert(m); but it didn't work. The alert wasn't popping. Then I tried putting the actual ID of the table and keeping it hidden but accessing the value but I still failed. Can someone please guide me. If you cannot understand the problem, I'll try to explain more.

Recommended Answers

All 2 Replies

Hi there, If you have any question relating to Asp.net, we advice you move it to the Asp.net forum

If you look carefully, it is related to Javascript and JQuery. Don't be a smarty pants.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.