| protected void RadGrid1_ItemDataBound(Object source, GridItemEventArgs e) |
| { |
| if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
| { |
| //first reference the edited grid item |
| GridEditableItem editedItem = e.Item as GridEditableItem; |
| GridEditManager editMan = editedItem.EditManager; |
| //reference the column editor which holds the dropdown list instance in the edit form |
| GridDropDownColumnEditor editor = editMan.GetColumnEditor("SectionID") as GridDropDownColumnEditor; |
| string selectedValue = editor.SelectedValue; |
| // change the data source for ContactTitle with custom code here |
| editor.DataSource = mySectionController.getAllModuleSections(); |
| editor.DataBind(); |
| editor.SelectedValue = selectedValue; |
| } |
| } |
| <telerik:GridDropDownColumn DataField="SectionID" HeaderText="SectionID" |
| UniqueName="SectionID" ListTextField="SectionName" ListValueField="SectionID"> |
| </telerik:GridDropDownColumn> |
| function onClose(window, result) |
| { |
| $get("<%= TextBox1.ClientID %>").text = result; |
| } |
Hi all,
I am using radcombo with OnItemsRequested event,
I want to add one default item say <Unknown> in to combo,
i tried to add as below, but it displays <Unknown> item many times. Item is added in each request.
| <telerik:RadComboBox ID="rcbBeginPeriod" runat="server" |
| Width="250px" Height="100px" Skin="Office2007" |
| AllowCustomText="false" |
| ShowToggleImage="true" |
| ShowMoreResultsBox="True" |
| EnableLoadOnDemand="True" |
| MarkFirstMatch="True" |
| OnItemsRequested="rcbBeginPeriod_ItemsRequested" |
| EnableVirtualScrolling="true" |
| > |
| </telerik:RadComboBox> |
| protected void rcbBeginPeriod_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) |
| { |
| try |
| { |
| EventInfo objEventInfo = new EventInfo(); |
| List<ctblPeriod> resultSet = null; |
| resultSet = objEventInfo.GetAllQuarterPeriods(e.Text); |
| try |
| { |
| int itemsPerRequest = PRESCONSTANTS.COMBO_ITEMS_PER_REQUEST; |
| int itemOffset = e.NumberOfItems; |
| int endOffset = itemOffset + itemsPerRequest; |
| if (endOffset > resultSet.Count) |
| { |
| endOffset = resultSet.Count; |
| } |
| if (endOffset == resultSet.Count) |
| { |
| e.EndOfItems = true; |
| } |
| else |
| { |
| e.EndOfItems = false; |
| } |
| for (int i = itemOffset; i < endOffset; i++) |
| { |
| rcbBeginPeriod.Items.Add(new RadComboBoxItem(resultSet[i].Period, resultSet[i].ID.ToString())); |
| } |
| if (resultSet.Count > 0) |
| { |
| lblBeginPeriodID.Text = ""; |
| e.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), resultSet.Count.ToString()); |
| } |
| else |
| { |
| lblBeginPeriodID.Text = ""; |
| e.Message = "No matches"; |
| } |
| } |
| catch |
| { |
| lblBeginPeriodID.Text = ""; |
| e.Message = "No matches"; |
| } |
| finally |
| { |
| if (!rcbBeginPeriod.Items.Contains(new RadComboBoxItem("<Unknown>", "-1"))) |
| rcbBeginPeriod.Items.Add(new RadComboBoxItem("<Unknown>", "-1")); |
| } |
| } |
| catch (Exception ex) |
| { |
| } |
| } |
Please help me to solve this problem.
Thanks
Amol
given that there is some performance issues (I will make a seperate post for this),
i decided to make decoration of controls user controlled, in otherwords i let the user of my app decide which controls they want decorated, i basically save a string comma seperated to db and read it back, however I am not sure how to translate these strings (multiple) into FormDecoreatedControls enums
basically in short i have a string.. "Label,TextBox,Default,Fieldset,H4H5H6,RadioButtons,Scrollbars,TextArea"
i want to programmically set this for the form decorated control.
thanks
| <telerik:RadComboBox |
| EnableEmbeddedSkins="false" |
| EnableLoadOnDemand="False" |
| AllowCustomText="False" |
| HighlightTemplatedItems="True" |
| SkinID="CBSelection" |
| ShowMoreResultsBox = "False" |
| Skin = "Black" |
| Filter="Contains" |
| ShowDropDownOnTextboxClick="true" |
| MarkFirstMatch="False" |
| EnableTextSelection = "True" |
| Height="150px" |
| runat="server" > |
| </telerik:RadComboBox> |