2017-10-19 296 views
0

我嘗試添加文本「選擇選項」爲0個的組合框指數卻顯示空白組合框:添加文本到第0指數

public void BindDdlPartyAccount() 
    { 
     PartyAccount objDDlBind = new PartyAccount(); 
     List<PartyAccount> ListDdlParty = new List<PartyAccount>(); 
     ListDdlParty = objDDlBind.getDDlPartyDetails(); 
     objDDlBind.selectOption = "Select Option"; 
     objDDlBind.selectOptionId = 0; 
     ListDdlParty.Insert(objDDlBind.selectOptionId, objDDlBind); 
     ddlEditPartyAcc.DataSource = ListDdlParty; 
     ddlEditPartyAcc.ValueMember = "PAId"; 
     ddlEditPartyAcc.DisplayMember = "name"; 
    } 

enter image description here

回答

0

你應該用自定義對象類型添加

istDdlParty = objDDlBind.getDDlPartyDetails(); 
objDDlBind.name= "Select Option"; 
+0

是它的工作,但爲什麼不能添加像設置objDDlBind.selectOption =「Select Option」; –

+0

因爲您的顯示成員屬性是名稱 – Sajeetharan

+0

確定是否得到它謝謝 –