I am trying to put dropdown box in a webdatgrid which works by the way but I have following issues.
1. How can I put "Please Select" prompt in Dropdown Box?
2. How can I make read only dropdown (I don't want dropdown text box gets editable)?
Thank you
Hi st91gzfs,
Thank you for posting in the community.
In order to have a Please Select prompt in your DropDownProvider I would suggest adding an item in your provider and setting its Enabled property to False. The markup for such an item would look like:
<ig:DropDownItem Enabled="False" Selected="False" Text="Please select a value"Value=""></ig:DropDownItem>
As per your second question, you can set the DisplayMode property of your provider to DropDownList in order to disallow the editing of the input field.
You can find more useful about the DropDownProvider at:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.1/CLR4.0/?page=Infragistics4.Web.v11.1~Infragistics.Web.UI.GridControls.DropDownProvider_members.html
Please let me know if this helps.
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://www.infragistics.com/support
Please let me know if you have any questions.
Please let me know if you need further assistance.
Thank you for your response.
That worked!
I have one more question, how about if I connect to Database. How do I display "Please Select"?
Once the dropdown provider comes in to focus (i.e. when you start editing the cell), by default the cells values is displayed in the input field of the dropdown. Therefore one approach would be to set the values of your cells to be "Please Select" initially.
Alternatively, you may handle the Focus client-side event for the provider, and the following code to should display "Please select" in the input field in case there are no selected items:
function WebDataGrid1_DropDown_Focus(sender, eventArgs) { if (null == sender.get_selectedItem() ){ sender._elements["Input"].value = "Please Select"; }}
Please let me know if you need further assistance regarding this matter.