Configure Data Source Wizard

Discussion in 'ASP .Net' started by rodchar, Jan 12, 2008.

  1. rodchar

    rodchar Guest

    hey all,
    i'm manually adding my items to my dropdownlist that will filter the
    gridview under it.

    i go thru the Configure Data Source Wizard on the gridview in which i
    specify the dropdownlist control value to be the filter in my WHERE clause.

    it works fine except i don't know how to get the NULL records to show up. is
    it possible to specify a NULL item when manually adding items to my
    dropdownlist?

    thanks,
    rodchar
     
    rodchar, Jan 12, 2008
    #1
    1. Advertisements

  2. rodchar

    Chad Scharf Guest

    When you are manually adding items to your DropDownList, simply use:

    MyDropDownListControl.Items.Add(string.Empty);

    Or in your Markup, <asp:ListItem Value="" Text="" />

    Then in your configure data source wizard, for that control you can specify
    the DefaultValue="" or leave it blank, then set the
    ConvertEmptyStringToNull="True".

    This will place a blank item in your select list in the rendered HTML, as
    well as set the value for the parameter to NULL when the blank option is
    selected for your data source control.

    Hope this helps.

    Thanks,
     
    Chad Scharf, Jan 14, 2008
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.