Number.prototype.padZero= function(len){
var s= String(this), c= '0';
len= len || 2;
while(s.length < len) s= c + s;
return s;
}
// используется:
(function(){
var myDate= new Date(), myDateString;
myDate.setDate(myDate.getDate()+10);
myDateString= [myDate.getDate().padZero(),
(myDate.getMonth()+1).padZero(),
myDate.getFullYear()].join('/');
alert(myDateString);
})()
/* value: (String)
09/09/2010
*/
это код VB для этого ...
myListBox.SelectionMode = Multiple
For each i as listBoxItem in myListBox.Items
if i.Value = WantedValue Then
i.Selected = true
end if
Next
Вот пример C #
(aspx)
<form id="form1" runat="server">
<asp:ListBox ID="ListBox1" runat="server" >
<asp:ListItem Value="Red" />
<asp:ListItem Value="Blue" />
<asp:ListItem Value="Green" />
</asp:ListBox>
<asp:Button ID="Button1"
runat="server"
onclick="Button1_Click"
Text="Select Blue and Green" />
</form>
(Code Behind)
protected void Button1_Click(object sender, EventArgs e)
{
ListBox1.SelectionMode = ListSelectionMode.Multiple;
foreach (ListItem item in ListBox1.Items)
{
if (item.Value == "Blue" || item.Value == "Green")
{
item.Selected = true;
}
}
}