Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
Add blank/empty row in DropDownList contained in UltraWebGrid
posted

Net 2.0, NetAdvantage Version: 6.2.

I have a DropDownList that contains data from a DataTable.  I'd like to add a blank row for display purposes that won't be stored in the database.
I'd just like the user to be able to select a blank if they make a mistake and select something from the dropdown, but want to return to having a blank.

Is this possible?  If so, how?

  • 28464
    Verified Answer
    posted

    I am not quite sure I get the scenario in details, in particular how is UltraWebGrid involved in this situation. Is the DropDownList inside a read-only CellTemplate (TemplatedColumn)? Or is it the default cell editor in edit mode? Or you have it defined manually, in RowEditTemplate? If you send some additional details, we could probably provide additional details.

     Meanwhile, I can suggest one idea that may work - you can set the AppendDataBoundItems property of the DropDownList to True and start with one empty item in the ASPX.- this way, the empty item will not be cleared upon databinding

     

        <asp:DropDownList
            runat="server"
            ID="DropDownList1"
            AppendDataBoundItems="true">
                <asp:ListItem Text=" " Value=" " ></asp:ListItem>      
            </asp:DropDownList>
       

    Hope this helps.