How to set Picklist value in code RRS feed

  • Question

  • Method 1:

    myCon.address1_addresstypecode = ddlAddressType.SelectedItem.Value.ToString();
    Error:  Cannot implicitly convert type 'string' to 'Picklist'

    Method 2:


    string address = ddlAddressType.SelectedItem.Value.ToString(); 

    Error:  Cannot implicitly convert type 'string' to 'Picklist'

    if i use the above methods am getting the error message which i marked in yellow color.

    how to insert the value for Picklist from C# to SQL SERVER 2005.

    Guid addr = new Guid(address); 
    Picklist pl = new Picklist();
    pl.Value =
    pl.name =
    myCon.address1_addresstypecode = address;


    Saturday, March 28, 2009 6:55 AM


  • Picklist

    plist_addr = new Picklist();

    plist_addr.name = ddlAddressType.SelectedItem.Text.ToString();

    plist_addr.Value =



    PicklistProperty addr_code = new PicklistProperty();

    addr_code.Name =


    addr_code.Value = plist_addr;

    Saturday, March 28, 2009 8:50 AM