I have an AJAX ComboBox Control and I added an AJAX Treeviw Control inside the ComboBox Item Template. When the post back happened for the second time the ComboBox Value come up with the node text value instead of the node value.
I want to store the Selected Node Value in the ComboBox Item(0).Value and to store the selected node text to the ComboBox Item(0).text and I want them to survive postbacks.
Is this passable? How can I do it?
When I use the following statements:
comboBox.get_items().getItem(0).set_text(node.get_text());
comboBox.get_items().getItem(0).set_value(node.get_value());
I get an error.
Please I need your help.
Thank you.
UserControl APSX Page:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="MenuOptionsTree.ascx.vb" Inherits="AMS.MenuOptionsTree" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<body bottommargin="0" topmargin="0" leftmargin="0" rightmargin="0" dir=rtl>
<script type="text/javascript">
function FindNode(comboBox, args)
{
var PassedValue = document.getElementById('<%=ValueToFind.ClientID%>').value
if (PassedValue == 0)
{
comboBox.set_text(comboBox.get_items().getItem(0).get_value());
document.getElementById('<%=NodeValue.ClientID%>').value = comboBox.get_items().getItem(0).get_value();
}
else if (PassedValue == -1)
{
comboBox.set_text("")
}
else
{
var treevw = comboBox.get_items().getItem(0).findControl("TreeMenuOptions");
var node = treevw.findNodeByValue(PassedValue);
if (node)
{
node.select()
document.getElementById('<%=NodeValue.ClientID%>').value = node.get_value();
comboBox.set_text(node.get_text());
comboBox.trackChanges();
comboBox.get_items().getItem(0).set_value(node.get_text());
comboBox.commitChanges();
}
}
}
function nodeClicking(sender, args)
{
var comboBox = $find("<%= cmbMenuOptions.ClientID %>");
var node = args.get_node()
document.getElementById('<%=NodeValue.ClientID%>').value = node.get_value();
comboBox.set_text(node.get_text());
comboBox.trackChanges();
comboBox.get_items().getItem(0).set_value(node.get_text());
comboBox.commitChanges();
comboBox.hideDropDown();
}
function StopPropagation(e)
{
if (!e) {
e = window.event;
}
e.cancelBubble = true;
}
function OnClientDropDownOpenedHandler(sender, eventArgs)
{
var treevw = sender.get_items().getItem(0).findControl("TreeMenuOptions");
var node = treevw.findNodeByValue(sender.get_items().getItem(0).get_value());
if (node != null)
{
node.select();
node.get_parent().expand();
node.scrollIntoView();
}
}
</script>
<telerik:RadComboBox ID="cmbMenuOptions"
Runat="server"
Height="200px"
Skin="Sunset"
Width="348px"
OnClientLoad="FindNode"
OnClientDropDownOpened="OnClientDropDownOpenedHandler">
<ItemTemplate>
<div ID="TreeDiv" onclick="StopPropagation(event)" dir=rtl>
<telerik:RadTreeView
ID="TreeMenuOptions"
Runat="server"
Height="350px"
Width="100%"
OnClientNodeClicking="nodeClicking"
Skin="Sunset">
<CollapseAnimation Duration="100" Type="OutQuint" />
<ExpandAnimation Duration="100" />
</telerik:RadTreeView>
</div>
</ItemTemplate>
<Items>
<telerik:RadComboBoxItem Text="" />
</Items>
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</telerik:RadComboBox>
<input id="NodeValue" value="0" runat="server" enableviewstate="true" type="hidden" />
<input id="ValueToFind" value="0" runat="server" enableviewstate="true" type="hidden" />
</body>
Code-Behind:
Public Property SelectNodeValue() As String
Get
Return NodeValue.Value
End Get
Set(ByVal value As String)
Me.ValueToFind.Value = value
End Set
End Property
Hi,
I am using following code to get all the rows (checkboxes) that have been selected by a user:
| function GetSelectedRows() |
| { // get all the rows with the checkbox checked |
| var strTickets = ""; |
| var grid = window["<%= RadGrid1.ClientID %>"]; |
| var masterTableView = grid.MasterTableView; |
| for (var i=0; i<masterTableView.Rows.length; i++) |
| { |
| var cell = masterTableView.GetCellByColumnUniqueName(masterTableView.Rows[i] , "TemplateEditColumn"); |
| alert("cell=" + cell); |
| var checkBox = cell.getElementsByTagName("INPUT")[0]; |
| if (checkBox && checkBox.checked) |
| { |
| var cellID = grid.MasterTableView.GetCellByColumnUniqueName(masterTableView.Rows[i], "TradeTicketID"); |
| strTickets = strTickets + cellID.innerHTML + ","; |
| } |
| } |
| return strTickets; |
| } |
Everything works fine when there is no grouping, or if the grid is grouped by one column. But when I group by two columns, it doesn't work. It fails on alert("cell=" + cell) with "cell=undefined". Any ideas?
We are using RadGrid v2.0.50727, this project was developed last year.
Thank you,
Julia
Dear Telerik Team,
I have a UserControl which contain an AJAX ComboBox control. When I add two instances of the same UserControl to a page they don't work very well so only one instance of the UserControl work fine.
Why is that happening? How to fix it? I needed to have two instances of the UserControl on my page.
Thank you.
<
telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" />
I also have a button after the radgrid which will allow me to send email to each person in my radgrid who are selected.
When I click on that button, how can I retrieve each selected row to send email to each person.
Thank you very much

