How to remove a row from dropdown list where it is binded with dataset?

Posted by Rajendra.prasad under ASP.NET on 6/22/2011 | Points: 10 | Views : 2202 | Status : [Member] | Replies : 4
Hi,
How to remove a row from dropdown list where it is binded with dataset?

Regards
Rajendra




Responses

Posted by: Vforvijay on: 6/22/2011 [Member] Starter | Points: 25

Up
0
Down
hi...what is your. need .You want to remove items from dropdown list or where

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajendra.prasad on: 6/22/2011 [Member] Starter | Points: 25

Up
0
Down
Vijay,

i'm having a dropdrown list binded with a dataset which contains "others" list and i need to remove those others list from the dataset and bind the dataset to the dropdown without "others" list

Regards,
Rajendra

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 6/22/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Try this code

ListItemCollection lic = MyDropDownList.Items;
foreach (ListItem li in lic)
{
MyDropDownList.Items.Remove(li);
break;
}



Thanks
Karthik
www.f5Debug.net

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 6/22/2011 [Member] Starter | Points: 25

Up
0
Down
hi...Try this code....

dr = sqlcmd.ExecuteReader()

If dr.HasRows Then
While dr.Read
If dr.Item(0).ToString <> "others" Then
dropdpwn.Items.Add(dr(0).ToString)
End If

End While
End If



Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response