.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Picklist: Remove Certain Items

Posted By: xack     Posted Date: May 17, 2011    Points:5   Category :ASP.Net
Hi, i'm trying a remove certain items or let me say i want to show certain items in picklist,

void BindDepartman()
DataTable dtTempDepartmans = Utils.GetPicklistAttributeValueKeyPair(_PortalBrandHelper.BrandProxy.BrandDedicatedCrmOrgName, "contact", "new_departman", false, "v", "t");

if (dtTempDepartmans != null && dtTempDepartmans.Rows.Count > 0)
ddl_departman.DataSource = dtTempDepartmans;
ddl_departman.DataTextField = "t";
ddl_departman.DataValueField = "v";
for (int i=0; i <= 35; i++)
if (i == 10 || i == 26)



it works fine but i've 35 items and i want to show only two of them i need a modification on this code. i need to show only 10 and 26. (yes this one is not show 10 and 26 i need reverse of this code)

Author: Maverick             
Posted Date: May 17, 2011     Points: 20   


You need to filter your datatable i.e."dtTempDepartmans"

use the below code to filter it based on some condition of primary key

DataView view = new DataView();

view.Table = dtTempDepartmans;
view.AllowDelete = true;
view.AllowEdit = true;
view.AllowNew = true;
view.RowFilter = "City = 'Berlin'";
view.RowStateFilter = DataViewRowState.ModifiedCurrent;
view.Sort = "CompanyName DESC";
Hope it helps


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend