DataGridView ComboBoxColumn problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DominicHelen
    New Member
    • Mar 2007
    • 7

    DataGridView ComboBoxColumn problem

    I made a windows application with c#. I have a datagridview with two DatagridviewCom boBoxColumn, Category and subCategory both of these two columns get their drop down list with Column.Items.Ad d(,.....). I did not use databinding since my user need to type free text which is not in the list .

    Now I need to let user click on Category column and to get corresponding subCategory list. I know there is some discusstion on <Link Removed>. But I can not use databinding since my user want to type free text. So what I can I do? I did try to use CellBeginedit and CellEndEdit and in those event, instead of use "datasource ".. I use column.Items.Ad d... and coulum.Items.Re move...,, But i keep get dataerror " System.Argument ExceptionataGri dViewComboBoxCe ll value is not valid." Can someone help me on this?



    Thanks !



    Helen
    Last edited by Frinavale; May 18 '07, 03:17 PM. Reason: Posting link to another forum
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by DominicHelen
    I made a windows application with c#. I have a datagridview with two DatagridviewCom boBoxColumn, Category and subCategory both of these two columns get their drop down list with Column.Items.Ad d(,.....). I did not use databinding since my user need to type free text which is not in the list .

    Now I need to let user click on Category column and to get corresponding subCategory list. I know there is some discusstion on <Link Removed>. But I can not use databinding since my user want to type free text. So what I can I do? I did try to use CellBeginedit and CellEndEdit and in those event, instead of use "datasource ".. I use column.Items.Ad d... and coulum.Items.Re move...,, But i keep get dataerror " System.Argument ExceptionataGri dViewComboBoxCe ll value is not valid." Can someone help me on this?



    Thanks !



    Helen
    Helen, please refrain from posting links to forums which are in competition with theScripts.

    For some reason I'm not clear on what you're trying to do.
    How are you filling your DataGrid without using DataBind?

    Could you explain the problem again and post a snippet of code you think is causing the error?

    Thanks,

    -Frinny

    Comment

    • preeethi
      New Member
      • May 2007
      • 3

      #3
      Hi Helen,
      I had the same problem. I found a way out just now.
      see my thread

      Hope that helps,
      Preethi

      Originally posted by DominicHelen
      I made a windows application with c#. I have a datagridview with two DatagridviewCom boBoxColumn, Category and subCategory both of these two columns get their drop down list with Column.Items.Ad d(,.....). I did not use databinding since my user need to type free text which is not in the list .

      Now I need to let user click on Category column and to get corresponding subCategory list. I know there is some discusstion on <Link Removed>. But I can not use databinding since my user want to type free text. So what I can I do? I did try to use CellBeginedit and CellEndEdit and in those event, instead of use "datasource ".. I use column.Items.Ad d... and coulum.Items.Re move...,, But i keep get dataerror " System.Argument ExceptionataGri dViewComboBoxCe ll value is not valid." Can someone help me on this?



      Thanks !



      Helen

      Comment

      • DominicHelen
        New Member
        • Mar 2007
        • 7

        #4
        Thanks, Preethi. I do appreciate your help. It seems that we had the same problem. But I wonder if you change to "
        CategoryCol.Dat aSource = catBS;
        CategoryCol.Dis playMember = "Name";
        CategoryCol.Val ueMember = "ID";
        " and the subCategorycol simliar. Can you add new value in your CategoryCol? I mean can you let user type something which is not in the drop down list? Because I have a event "CellValidateEv ent" to handle add new value like this:
        if (!CategoryCol.I tems.Contains(e .FormattedValue )
        {
        CategoryCol.Ite ms.Add(e.Format tedValue); }

        If I use databinding for CategoryCol, the above code will complain. How do you fix this?

        Thanks in advance!


        Helen







        Originally posted by preeethi
        Hi Helen,
        I had the same problem. I found a way out just now.
        see my thread

        Hope that helps,
        Preethi

        Comment

        Working...