Click the row cell in the list in the Repeater control. Data is displayed below the row.

Source: Internet
Author: User

In this demo, when we need to open a column on the list page, we want to display a row of data or a text under the column. Here we use the Repeater control that comes with asp.net.

Below is the js to be called
<Script language = "javascript">
Var $ = function (I ){
Return document. getElementById (I)
};
Function moreshow (ml, mr ){
If (mr = null | mr = ""){
Var e = $ (ml );
If (e. style. display! = 'Block '){
E. style. display = 'block ';
} Else {
E. style. display = 'none ';
}
Return false
}
Return true;
};
Function moreddhide (e ){
If (! E) var e = window. event;
If (e. srcElement ){
Var a = e. srcElement. getAttribute ("id ")
} Else {
Var a = e.tar get. getAttribute ("id ")
}
If (! = "More "){
$ ('Morelist'). style. display = 'none'
}
};
Document. onclick = moreddhide;
</Script>

 

<Asp: Repeater ID = "Repeater1" runat = "server">
<ItemTemplate>
<Div style = "height: 30px; width: 100%;">
<Ul>

// Call the js moreshow (s1, s2) s2 here to expand the next div by clicking that column
<Li style = "width: 150px;"> <a href = "Javascript:" id = "more" onclick = "moreshow ('<% # Eval (" Qid ") %> ',' <% # Eval ("QReplytime") %> '); "> </li>

<Li style = "width: 200px;"> <% # Eval ("Qsource") %> </li>

</Ul>
</Div>

// This div is used to display the position where data is displayed after the click column.
<Div style = "height: 100px; width: 100%; display: none;" id = '<% # Eval ("Qid") %>'>
<Ul>
<Li> question: </li> <li style = "width: 50%;"> <% # Eval ("QContent") %> </li> <br/>
</Ul>
</Div>
</ItemTemplate>
</Asp: Repeater>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.