Hi,
we are using infragestics for our .net web developement, I have couple of issues with webdropdown. may be we are missing few settings, please guide us to fix issues.
Version of WebDropDown: this in content page..<%
@ Register assembly="Infragistics35.WebUI.WebCombo.v9.2, Version=9.2.20092.1003, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.WebCombo" tagprefix="igcmbo"%> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:PlaceHolder ID="ph3" runat="server" /> <asp:Label ID="lbl123" runat="server" Text="" Font-Bold="True" ForeColor="#CC0000"></asp:Label> <asp:PlaceHolder ID="phSearchOptions" runat="server" /> <br /> <br /> <asp:Button ID="btnAddSearch" runat="server" Text="AddMoreSearch" onclick="btnAddSearch_Click"/> <br /> <br /> <br /> </ContentTemplate> </asp:UpdatePanel>
I am creating webdropdown with checkboxes(for multi select) dynamically and adding it to updatepanel control,
Issue: 1 Postback is occuring for valuchange everything is ok but if user wants to select four choices from dropdown, its getting postback for each selection, so ultimately user can select only one option at any point, but I need postaback has to be happen once they finish all selections or atleast closing that dropdown values. see the below image for your reference. After binding items to dropdown I am adding new item as --None-- for this also I am getting(you can see in the image) checkbox, generally it should not. here is the code for binding dropdown. sometimes styles are resetting they can see the checkbox and option but only as plain text is there any style I need to set everytime. because its an dynamic control it get created on every postback.
WebDropDown wdd = new WebDropDown();wdd.DataSource = FilterSearchFields(); wdd.TextField = "SearchFieldName";wdd.ValueField = "SearchFieldID";wdd.DataBind();wdd.Items.Insert(0, new DropDownItem("--None--", "-1"));wdd.ID = dropDownID;wdd.AutoPostBack = true;wdd.SelectionChanged += new DropDownSelectionChangedEventHandler(wdd_SelectionChanged);wdd.EnableMultipleSelection = true;wdd.EnableClosingDropDownOnSelect = false;AddPostbackTrigger(wdd.ID);
Issue: 2 Can I know the style which shows the below dropdown list to length of its list. I have equalsto, contains but the width of that box showing till its contents but I want to display till the width of dropdown, please let me know is there any style I need to set.
Issue:3 I am adding new item to dropdown after binding list, first time I cant see that option but second time I can see that option in second dropdown but not in first dropdown. like I said theese are dynamic dropdowns, I am creating them in PreInit event. initially there would be only one entry after user clicks on "AddMoreSeach" button then I am creating one more row with different controls. I am placing images for your reference.
see on this Image I can't see the '--None--' item.
After use clicks on AddmoreSearch then I am adding second row like below, in second row I can see --None-- text . for bothe theese rows I am using same code becos theese are dynamic controls it uses same code for each n every row.
thanks in advance for your reply..
if you are creating the controls dynamically. IE webDropDown1 = new webDropDown..
Then you should also set the styleSetName in code as well. and it looks to me like you are using Office2007Blue
thanks for your reply, issue 2 and issue 3 answers are good and worked fine.
comming to Issue 1: I implemented javascript function. as you said wdd.ClientEvents.DropDownClosed = "dropDownClosed";wdd.ClientEvents.SelectionChanged = "selectedIndexChanged";
here is BLOCKED SCRIPT<script type="text/javascript"> var selectionChanged = false; function selectedIndexChanged(sender, eventArgs) { selectionChanged=true; }
function dropDownClosed(sender, args) { if (selectionChanged) { var dd = sender._callbackManager.createCallbackObject(); sender._callbackManager.execute(dd, true); selectionChanged = false; } } </script>
I need to filter second dropdown as per first dropdown selection, so it worked fine but I am missing styles now. as I said theese are dynamic controls so I am creating them in Page_init so every postback it creates controls first then it comes to dropdown valuechange event. so that time it loosing it styles, is there any way I can reset styles on selectionindex change event. here is screent shot .
I appriciate your quick reply
About issue 1: in that case you should disable automatic postback on selection: AutoPostBackFlags SelectionChanged=Off (which is the default), and trigger a postback manually after the control is closed. For example you can handle the DropDownClosing or DropDownClosed client-side event, and add the following code to the javascript handler for that event:
__doPostBack();
About issue 2: You can control the width of the dropdown container by setting the DropDownContainerWidth property. Usually if you have Width set for the control, the default width of the dropdown container is the same, so that they are aligned.
About issue 3: If you want to see different default Text in the control when it's loaded initially, you do not need to add a special item for this, you only need to set the CurrentValue property, to something like CurrentValue=" -- None -- ";
Hope it helps. Please let me know if you have any other issue and if the above works fine for you.
Angel