I have problems with the RadComBox Load-On-Demand combined with data binding.
Below is the code,
aspx
(I am using declaretive datasource (dataset) ), Below aspx is putting under FormView,
<telerik:RadComboBox Skin="Hay" ID="RadComboVendorID" runat="server"
DataSourceID="DBDataSource1" DataMember="PurchaseHeader.VendorInformation_Via_VendorID" DataTextField="VendorID" DataValueField="VendorID" SelectedValue ='<%# Bind("VendorID") %>' DropDownWidth ="550" Height ="270" Width ="105"
HighlightTemplatedItems = "true" Sort="Ascending" MarkFirstMatch="True" AutoPostBack = "true" OnItemsRequested= 'RadComboBox_ItemsRequested' EnableLoadOnDemand ="true" ShowMoreResultsBox ="true" EnableVirtualScrolling ="true" />
and, Code Behind,ItemsRequested function, I filter out the data source that binded to the page base on whatever condition, see below,
Public Sub RadComboBox_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
Dim combo As RadComboBox = TryCast(sender, RadComboBox)
datasource.FilterTable("VendorInformation", "VendorID LIKE '%abcedfg%'")
combo.DataSource = ds
combo.databind()
End Sub
But, it give error on combo.databind() line, say binding function must bind in the context of .................
i take away combo.databind() line, the datasource only get filtered after fresh not through AJAX posting.
Any solution for that ? Thanks .
| <telerik:GridTemplateColumn UniqueName="StatusColumn" HeaderText="Approved Status"> |
| <ItemTemplate> |
| <asp:Label id="lblStatus" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "status") %>'> |
| </asp:Label> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <asp:DropDownList id="ddlApprovalStatus" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlApprovalStatus_SelectedIndexChanged" > |
| <asp:ListItem Text="Pending" Value="False" Selected="True"></asp:ListItem> |
| <asp:ListItem Text="Approved" Value="True"></asp:ListItem> |
| </asp:DropDownList> |
| </EditItemTemplate> |
| <ItemStyle Width="40px" /> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn DataField="id" DataType="System.Int32" HeaderText="id" |
| ReadOnly="True" SortExpression="id" UniqueName="id" Visible="false"> |
| <ItemStyle Width="100px" /> |
| </telerik:GridBoundColumn> |
| protected void ddlApprovalStatus_SelectedIndexChanged(object source, System.EventArgs e) |
| { |
| } |
| <telerik:RadGrid ID="RagCategories" runat="server" Height="399px" Width="698px" AutoGenerateColumns="False" Skin="Sunset" OnDataBound="RagCategories_DataBound"> |
| <MasterTableView> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <Columns> |
| <telerik:GridTemplateColumn DataField="CategoryID" HeaderText="ID" UniqueName="TemplateColumn"> |
| <ItemTemplate> |
| <asp:Label ID="lblID" Font-Bold="true" runat="server" Text='<%# Eval("CategoryID")%>' ></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn HeaderText="Forum Categories" UniqueName="TemplateColumn1"> |
| <ItemTemplate> |
| <asp:HyperLink id="link1" Text='<%# Eval("CATEGORYNAME")%>' NavigateUrl='<%# Eval("[LINK]")%>' runat="server" > </asp:HyperLink> |
| <asp:Label ID="descr" runat="server" Text='<%# Eval("Description")%>'></asp:Label> |
| </ItemTemplate><HeaderStyle Font-Bold="True"> |
| </HeaderStyle> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| </MasterTableView> |
| <FilterMenu EnableTheming="True" Skin="Sunset"> |
| <CollapseAnimation Type="OutQuint" Duration="200"> |
| </CollapseAnimation> |
| </FilterMenu> |
| <ClientSettings> |
| <ClientEvents OnRowClick="OnClientClick="javascript: return SetHidSelectedRows()"" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
| <asp:HyperLink id="link1" Text='<%# Eval("CATEGORYNAME")%>' NavigateUrl='<%# Eval("[LINK]")%>' runat="server" > |
Greetings,
First some background information:
I have a RadTextBox which accepts an employee id (if known). If the employee id is not known, there is a hyperlink button accompanying the RadTextBox, which opens up a search dialog in a RadWindow. In the RadWindow, the user can enter search criteria to filter a list of employees, which appear in a RadGrid. The leading field in the RadGrid contains a hyperlink that, when clicked, should do the following:
1. Close the RadWindow.
2. Set the value of the RadTextBox in the parent window.
3. Cause a postback in the parent window.
I’ve got most of it working, but have several questions.
1. Is it possible to set (via Javascript) the value of the RadTextBox in the parent window such that a postback would automatically occur (the RadTextBox specifies AutoPostBack=”true”)?
2. What is the correct way to set the input values associated to a RadTextBox? I was trying to use a generic solution that would work for other similar search dialogs; so I pass the Id of the RadTextBox through as a querystring parameter in the NavigateUrl attribute of the RadWindow. The following Javascript function is called when the RadWindow is closed (OnClientClosed attribute):
function onClientCloseLOV(oWnd, args) {
var arg = args.get_argument();
if (arg) {
$get(arg.id).value = arg.value;
}
}
Note: “arg.id” is the RadTextBox ID attribute in the parent window. The problem here is; if I subsequently click on the input field the value disappears!