You can also insert ListItem at specific location.
In .Add Method Items are append.
There is one method ".Insert" to insert items as specified location.
Syntax :
Example :
In this example the item is inserted at 2nd place because index is zero based.
In .Add Method Items are append.
There is one method ".Insert" to insert items as specified location.
Syntax :
DropDownList.Items.Insert(index as integer , System.Web.Ui.WebControls.ListItem)
Hear index is based on zero.Example :
Dim objListItem As ListItem
objListItem = New ListItem("Software", 1)
ddlProduct.Items.Insert(1, objListItem)
objListItem = New ListItem("Software", 1)
ddlProduct.Items.Insert(1, objListItem)
In this example the item is inserted at 2nd place because index is zero based.
No comments:
Post a Comment