Drop Down List item add in 0 index

ddlCategory.Items.Insert() have two overloads
1- define index,you can define value with item name by (ListItem)
that is the simple code to add item of zero index in drop down list:
    ddlCategory.Items.Insert(0, new ListItem("--Select Category--","0"));
        ddlCategory.SelectedIndex = 0;

2- define index, only allowed to add item name like string

Comments

Popular posts from this blog

Add Image through base64 on PDF in itextsharp

how to insert text and tags at the cursor CKEDITOR