or
item = combo.FindItemByText("abc");
item.Select()
it works in postback ...but when i use tab button to treverse more control...it again clear or select any other item...
please help to select the combo wrt to above problems
thanks
<telerik:GridTemplateColumn UniqueName="TemplateDeleteColumn">
<ItemTemplate>
<asp:HyperLink ID="DeleteLink" runat="server" Text="Delete"></asp:HyperLink>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:RadListBox ID="RadListBox1" Width="200px" Height="300px"
SelectionMode="Multiple" runat="server"></telerik:RadListBox>
<telerik:RadListBox ID="RadListBox2" Width="300px" Height="300px" runat="server">
</telerik:RadListBox>void button1_Click(object sender, EventArgs e)
{
foreach (RadListBoxItem selectedItem in RadListBox1.SelectedItems)
{
RadListBox2.Items.Add(new RadListBoxItem(selectedItem.Text));
}
}<telerik:RadGrid ID="rgLog" runat="server" ShowGroupPanel="False" AllowPaging="true" ItemStyle-BackColor="#ffe394" BackColor="White" Visible="true" Height="200" PageSize="25" Skin="Office2010Black" AllowSorting="true" AutoGenerateColumns="false" BorderWidth="0px" Width="1000" AllowCustomPaging="True" OnNeedDataSource="rgLog_NeedDataSource" OnItemDataBound="rgLog_ItemDataBound"> <AlternatingItemStyle BackColor="White" /> <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" AllowGroupExpandCollapse="True" ReorderColumnsOnClient="True" AllowDragToGroup="False"> <Scrolling AllowScroll="False" UseStaticHeaders="True" /> <Resizing AllowColumnResize="true" AllowRowResize="true" /> </ClientSettings> <GroupingSettings ShowUnGroupButton="False" /> <PagerStyle AlwaysVisible="true" Position="TopAndBottom" /> <MasterTableView TableLayout="Fixed" CommandItemDisplay="Top"> <NoRecordsTemplate> <br /> No Records matched this search.<br /> <br /> </NoRecordsTemplate> <CommandItemSettings ShowExportToWordButton="false" ShowExportToExcelButton="false" ShowExportToCsvButton="true" ShowExportToPdfButton="false" ShowAddNewRecordButton="false" /> <Columns> <telerik:GridTemplateColumn HeaderText="View Events" ItemStyle-HorizontalAlign="Center"> <ItemTemplate> <a href="<%# GetURL( Eval("Number")) %>"> <img src='images/1258747021_old-edit-find.png' alt="View Detail" border="0" /> </a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="View Report" ItemStyle-HorizontalAlign="Center"> <ItemTemplate> <a href="<%# GetChartURL( Eval("Number")) %>"> <img src='images/1259005159_pie_chart_search.png' width="24" alt="View Detail" border="0" /> </a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="Number" Visible="false" /> <telerik:GridBoundColumn DataField="Percent %" HeaderText="% of Total" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:p}" /> <telerik:GridBoundColumn DataField="COUNT" HeaderText="Event Count" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:###,###,###}" /> </Columns> </MasterTableView> </telerik:RadGrid><Telerik:DDLGridColumn UniqueName="ProductType" Query="select Name AS ProductType, ID AS ProductTypeID From ProductTypes WHERE RetailerID={1}" GetRetailerIDFromSession="True" DataField="ProductType" DataValueField="ProductTypeID" HeaderText="ProductType" SortExpression="ProductType"> <ItemTemplate> <%# Eval("ProductType")%> </ItemTemplate></Telerik:DDLGridColumn>public class DDLGridColumn: GridTemplateColumn { protected override void SetupFilterControls(System.Web.UI.WebControls.TableCell cell) { RadComboBox rcBox = new RadComboBox(); rcBox.ID = this.UniqueName + "_rcbox"; rcBox.AutoPostBack = true; rcBox.DataTextField = this.DataField; rcBox.DataValueField = DataValueField ?? this.DataField; rcBox.SelectedIndexChanged += rcBox_SelectedIndexChanged; rcBox.Width = FilterControlWidth; string query = query = string.Format(this.Query, this.DataField); DataTable table = DBLayer.GetDataTable(query, CommandType.Text); DataRow row = table.NewRow(); table.Rows.InsertAt(row, 0); rcBox.DataSource = table; cell.Controls.Add(rcBox); } private void rcBox_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter", new Pair()); } protected override void SetCurrentFilterValueToControl(TableCell cell) { if (!(this.CurrentFilterValue == "")) { ((RadComboBox)cell.Controls[0]).Items.FindItemByValue(this.CurrentFilterValue).Selected = true; } } protected override string GetCurrentFilterValueFromControl(TableCell cell) { string currentValue = ((RadComboBox)cell.Controls[0]).SelectedItem.Value; this.CurrentFilterFunction = (currentValue != "") ? GridKnownFunction.EqualTo : GridKnownFunction.NoFilter; return currentValue; } }
Html.Telerik().ComboBox().Name("StyleImage").ClientEvents(events => events.OnChange("onChange") )here is js code
function onChange(e) { alert(e.value);} here is grid onedit
function Grid_onEdit(e) { var styleImage = $('#StyleImage').data('tComboBox'); $.getJSON(appUrl("Controller/Action"), { styleId: styleValue }, function (data) { styleImage.dataBind(data.value); styleImage.value(e.dataItem['DefaultImage']); } ); } } Here is controller code
public JsonResult Action(string styleId) { List<string> images=new List<string>(); return Json(new { success = true, value = images }, JsonRequestBehavior.AllowGet); }this is how I am seeing rendered code for combo box
<div class="t-animation-container" style="width: 150px; height: 214px; position: absolute; z-index: 10002; top: 382.817px; left: 599.733px; display: none;">
I figured out how to set defaults for the multiple check boxes.
Here is my example:
DataTable tableMonths = new DataTable();tableMonths.Columns.Add("name", typeof(int));tableMonths.Columns.Add("value", typeof(string));tableMonths.Rows.Add(12, "12");tableMonths.Rows.Add(24, "24");tableMonths.Rows.Add(36, "36");tableMonths.Rows.Add(48, "48");tableMonths.Rows.Add(60, "60");tableMonths.Rows.Add(72, "72");RadComboBoxMonths.DataSource = tableMonths;RadComboBoxMonths.DataTextField = "name";RadComboBoxMonths.DataValueField = "value";RadComboBoxMonths.DataBind();// preselect these terms by defaultRadComboBoxMonths.SelectedValue = "12";RadComboBoxItem twelveMonths = (RadComboBoxItem)RadComboBoxMonths.SelectedItem;twelveMonths.Checked = true;RadComboBoxMonths.SelectedValue = "24";RadComboBoxItem twentyFourMonths = (RadComboBoxItem)RadComboBoxMonths.SelectedItem;twentyFourMonths.Checked = true;RadComboBoxMonths.SelectedValue = "36";RadComboBoxItem thritySixMonths = (RadComboBoxItem)RadComboBoxMonths.SelectedItem;thritySixMonths.Checked = true;