WebGrid Community Server

Welcome to WebGrid Community Server Sign in | Join | Help
in Search

New drop down capability

Last post 09-10-2008, 5:10 by jh-hamptonpark. 6 replies.
Sort Posts: Previous Next
  •  09-03-2008, 0:13 764

    New drop down capability

    Web grid is awesome.  If i could do the following, i could do everything i need to do.

    1)  i would like to specify a foreignkey column, specify IsInDataSource="False" and then have whatever value is showing when in edit mode to be saved to the record i'm adding or editing.  I don't want to save the primary key value but the actual info selected in the dropdown. 

    2) see http://forums.webgrid.com/forums/thread/440.aspx 
    In master/slave grids, I want to be able to change the default query to not use the Identity field but something else i specify.  Setting the primary key field to something else doesn't work. 

     

  •  09-04-2008, 18:49 769 in reply to 764

    Re: New drop down capability



    1)

    You can do this in next version of WebGrid. Foreign key and Many-to-Many columns gets 'DataSource' property which you can use to achieve this.  (You can download this from Premium section)

    2)

    This is not supported at the moment.


    Olav Botterli, WebGrid Founding Developer
  •  09-06-2008, 22:36 771 in reply to 769

    Re: New drop down capability

    Will it be available outside the premium section soon?

  •  09-08-2008, 17:45 773 in reply to 771

    Re: New drop down capability

    I've downloaded the newest beta of webgrid.dll (by becoming a premium member).  I've configured a foreign key column to show me drop down of choices i want saved in a database field but it still doesn't work.  Here's my code:

    <WG:foreignkey SortExpression="value" ValueColumn="value" Where="[Choices].[category]='Grade'" DataSourceId="Choices" ColumnId="Grade" AllowEmpty="False" NullText="Select" EditAlign="Left" GridAlign="Left" IsInDataSource="False" MaxSize="30" Priority="56" Required="True" Title="Grade" Visibility="Both"></WG:Foreignkey>

    The drop down does show me the data to choose from but it won't save what i choose.  It doesn't save anything.  I want to save the text displayed in the drop down, not the foreign key number.  Can you tell me how to do this with the new webgrid.dll version?  Thanks

  •  09-09-2008, 10:03 776 in reply to 773

    Re: New drop down capability

    You should look at the 'foreign key' examples found in the Premium section. This contain examples how you can retrieve Data on post back. You should use 'Value' instead of 'ValueID'

    Olav Botterli, WebGrid Founding Developer
  •  09-10-2008, 2:08 779 in reply to 776

    Re: New drop down capability

    are you referring to Demo3 (Cascading foreign keys example)?  do you have a vb.net version (I use vb, not C#)?  Is there any difference?  Thanks
  •  09-10-2008, 5:10 780 in reply to 776

    Re: New drop down capability

    I've looked at the examples and i don't understand them (i'm not a real programmer).  I'm not sure how to use post back for what i'm trying to do.  I have 2 text columns that people normally type their info into and it saves it to the database.  To make it easier, i wanted what they type to from a list, so instead of typing, they would just choose from a drop down and it save to the fields in the database.  Using foreign key, i can have the drop down display the choices i want them to choose from but it doesn't save unless i specify it is in the datasource, but then it only saves the primary key info which isn't what i want.  I want the text that is actually chosen from the dropdown to be saved. 

    I thought maybe the beforeupdateinsert method would work but again i'm not sure what the coding should be (even after looking at the examples).  I also read it may not work right if it is a required field. 

     

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems