<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<input type="button" value="Up"onclick="moveUp(this.form['_lb2']);" />
<asp:ListBox ID="_lb2" name="_lb2" runat="server" Height="100px" Width="170px">
<asp:ListItem>Data1</asp:ListItem>
<asp:ListItem>Data2</asp:ListItem>
<asp:ListItem>Data3</asp:ListItem>
<asp:ListItem>Data4</asp:ListItem>
</asp:ListBox>
<input type="button" value="Down"onclick="moveDown(this.form['_lb2']);" />
<div>
<br />
</div>
</form>
</body>
<script type="text/javascript">
function moveUp(sel)
{
var idx = sel.selectedIndex;
var opt;
// Only move up if not first
if (idx > 0)
{
opt = sel.options[idx];
sel.insertBefore(opt, sel.options[--idx]);
}
}
function moveDown(sel)
{
var idx = sel.selectedIndex;
var opt;
// Only move up if not first
if (idx < sel.length-1)
{
opt = sel.options[idx];
sel.insertBefore(sel.options[++idx],opt);
}
}
</script>
</html>
Subscribe to:
Post Comments (Atom)
-
Remarks This property specifies the appearance of the embedded Windows Media Player. When uiMode is set to "none", "mini...
-
<body> <form id="form1" runat="server"> <img class="RibbonL" src="Imag...
-
Partial Class Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Lo...
What is the use of n-tier architecture and 3-tier architecture?
how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it ...
No comments:
Post a Comment