<
telerik:RadComboBox
ID="edtSubDisciplineID"
runat="server"
Width="100%"
DataTextField="disciplineName"
DataValueField="disciplineID"
Skin="Vista"
OnClientSelectedIndexChanging="loadCostCodes" >
</telerik:RadComboBox>
<
telerik:RadComboBox
ID="edtCostCodeID"
runat="server"
Width="100%"
DataTextField="costCodeFullName"
DataValueField="costCodeID"
Skin="Vista"
EnableLoadOnDemand="true"
OnItemsRequested="onCostCodeItemsRequested">
</telerik:RadComboBox>
and then, I've got the following Javascript on the same page:
<script type="text/javascript">
function loadCostCodes(item)
{
var ctrl = <%= edtCostCodeID.ClientID %>;
if (item.Index > 0)
{
ctrl.requestItems(item.Value, false);
}
else
{
ctrl.Items = [];
ctrl.setText(" ");
ctrl.clearItems();
}
}
</script>
Problem:
When I change the selected item in the parent combo, I get the following javascript error:
"Object doesn't support this property or method"
The problem occurs on the "item.Index" line, as well as the "ctrl.requestItems()" call. I have tried upper and lowercase. I have put alert() calls in there and verified I have the control is found properly. I have verified that "item" passed into the javascript call is not null.
So, what am I missing? I have been thru the tutorials and forums messages to no avail. I am simply trying to get a parent/child cascading dropdown to work. Your help is appreciated!
Jim
Hello
I’m trying to return a column value from a radgrid client-side after a LinkButton is clicked in a GridTemplateColumn (the other columns are generated dynamically) and open a radWindow. I have looked through the documentation and posts and found some useful information but am still unable to accomplish this task.
I am able to return the correct value using the following code when different rows are clicked in the grid:
SCRIPT
----------------------------------
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function RowSelected(sender, eventArgs)
{
var dataItem = $get(eventArgs.get_id());
var grid = sender;
var MasterTable = grid.get_masterTableView();
var row = MasterTable.get_dataItems()[dataItem.rowIndex - 1];
var cell = MasterTable.getCellByColumnUniqueName(row, "appID");
//here cell.innerHTML holds the value of the cell
//alert(cell.innerHTML);
var window = radopen("../appointmentInfo.aspx?EID=" + cell.innerHTML,"RadWindow1");
window.center();
}
</script>
</telerik:RadCodeBlock>
----------------------------------
GRID CODE
----------------------------------
<telerik:RadGrid id="gridResults" runat="server" Skin="Telerik" AllowSorting="True" GridLines="None" DataSourceID="ObjectDataSource1" Style="left: 0px; top: 5px; position: relative;" Width="950px" ShowGroupPanel="True">
<MasterTableView allownaturalsort="False" DataSourceID="ObjectDataSource1" ClientDataKeyNames="appID" DataKeyNames="appID">
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridTemplateColumn HeaderText="View" UniqueName="TemplateColumn">
<ItemTemplate>
<asp:LinkButton ID="lnkBtnView" runat="server" CommandName="ViewApp" Style="position: relative" ToolTip="View the Appointment" OnClientClick="GetSelectedID()">View</asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings AllowDragToGroup="True">
<ClientEvents OnCommand="function(){}" OnRowSelected="RowSelected" />
<Selecting AllowRowSelect="True" />
</ClientSettings>
<FilterMenu EnableTheming="True" Skin="Telerik">
<CollapseAnimation Duration="200" Type="OutQuint" />
</FilterMenu>
</telerik:RadGrid>
----------------------------------
The above code works properly. However, I would like to open the window when the link button in the grid is clicked rather than when a row is clicked. The following code works when I call the ‘GetSelectedID’ function from the ‘OnClientClick’ event for the link button, but always returns value from the first row due to the index setting of [0] when getting the value for var DataItem.
function GetSelectedID()
{
var DataItem = $find("<%= gridResults.ClientID %>").get_masterTableView().get_dataItems()[0];
var keyValue = DataItem.getDataKeyValue("appID")
var oWnd = radopen("../appointmentInfo.aspx?EID=" + keyValue,"RadWindow1");
oWnd.Center();
//alert(keyValues);
}
Is there a way to return the index of the row that is clicked in function GetSelectedID() or an alternate way of accomplishing this?
Thanks for any suggestions,
Brian