How to Insert row from Binded Combo Box
-
Hi Friends, I am using the following methods to bind the windows.combobox control. In this screen how to insert a value to 0 position of the list. cboKeyword.DataSource = dsResult.Tables["tmpTable"]; cboKeyword.DisplayMember = "ProductKeyword"; cboKeyword.ValueMember = "PortalProductMasterID"; Keyword k = new Keyword(); k.KeywordID = ""; k.KeywordName = "<-Select Keyword->"; cboKeyword.Items.Insert(0, k); It is not working. Please Help Thanks in Advance Rameshkumar Thirumalaisamy
-
Hi Friends, I am using the following methods to bind the windows.combobox control. In this screen how to insert a value to 0 position of the list. cboKeyword.DataSource = dsResult.Tables["tmpTable"]; cboKeyword.DisplayMember = "ProductKeyword"; cboKeyword.ValueMember = "PortalProductMasterID"; Keyword k = new Keyword(); k.KeywordID = ""; k.KeywordName = "<-Select Keyword->"; cboKeyword.Items.Insert(0, k); It is not working. Please Help Thanks in Advance Rameshkumar Thirumalaisamy
hi, it seem that you are binding two different types to a single combobox. first you bind the "tmpTable" with the columns "ProductKeyword" and "PortalProductMasterID" then you bind an object "Keyword". but from the code you provided, i don't see any similarity between the two - "tmpTable" and "Keyword". your existing "Keyword" class doesn't contain the properties you are trying to bind. what you should do is make the class "Keyword" comparable to the table you are trying to bind, i.e. add the properties "ProductKeyword" and "PortalProductMasterID" to you existing class - "Keyword". hope this helps reagards :)
-
Hi Friends, I am using the following methods to bind the windows.combobox control. In this screen how to insert a value to 0 position of the list. cboKeyword.DataSource = dsResult.Tables["tmpTable"]; cboKeyword.DisplayMember = "ProductKeyword"; cboKeyword.ValueMember = "PortalProductMasterID"; Keyword k = new Keyword(); k.KeywordID = ""; k.KeywordName = "<-Select Keyword->"; cboKeyword.Items.Insert(0, k); It is not working. Please Help Thanks in Advance Rameshkumar Thirumalaisamy
Please Check It cboKeyWord.Items.Add( new ListItem("<-Select KeyWord>-", "0"));