4 Answers, 1 is accepted
Please try the following JavaScript to access the ItemTemplate Control from Clientside.
JavaScript:
function
OnClientClicked(sender, args) {
var
listview = $find(
'<%= RadListView1.ClientID %>'
);
// pass id of the itemtemplate control
var
textbox = $telerik.findControl(listview.get_element().parentNode,
"RadTextBox1"
);
}
Thanks,
Shinu.
Hi ,
I have a RadListView which repeats items depending on the number of records retrieved from the database
I have button,labels and textboxes and a RadAjaxPanel. The RadAjaxPanel contains textboxes and labels.
On Initial loading, the RadAjaxPanel is invisible.
In the Javascript code, "var listview = $find('<%= RadListView1.ClientID %>');" is returning null.
My requirement is When I click on the button, the corresponding RadAjaxPanel should be made visible/Invisible(Show/Hide) using Javascript function
Please help me out.
I am attaching the code below for reference
<script type="text/javascript">
function enablePanel() {
var listview = $find('<%= RadListView1.ClientID %>');
var panel = $telerik.findControl(listview.get_element().parentNode, "RadAjaxPanel1");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="align-content: center; margin: auto; width: 900px; position: relative; top: 100px;">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<telerik:RadListView ID="RadListView1" runat="server">
<ItemTemplate>
<div style="background-color: lightblue; border: 1px solid black; width: 600px; margin-bottom: 10px;">
<table>
<tr>
<telerik:RadButton ID="RadButton1" runat="server" Text="+" OnClientClicked="enablePanel()"></telerik:RadButton>
</tr>
<tr>
<td>
<telerik:RadLabel ID="RadLabel1" Text="Notification Number" runat="server"></telerik:RadLabel>
</td>
<td>
<telerik:RadTextBox ID="RadTextBox1" Text='<%# Bind("ItrNotifNumber") %>' runat="server"></telerik:RadTextBox>
</td>
<td>
<telerik:RadLabel ID="RadLabel2" Text="ItrNeId" runat="server"></telerik:RadLabel>
</td>
<td>
<telerik:RadTextBox ID="RadTextBox2" Text='<%# Bind("ItrNotifExchangeId") %>' runat="server"></telerik:RadTextBox>
</td>
</tr>
<tr>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Visible="false">
<td>
<telerik:RadLabel ID="RadLabel3" Text="Abr RefKey" runat="server"></telerik:RadLabel>
</td>
<td>
<telerik:RadTextBox ID="RadTextBox3" Text='<%# Bind("AbrRefKey") %>' runat="server"></telerik:RadTextBox>
</td>
<td>
<telerik:RadLabel ID="RadLabel4" Text="Notif Tcd" runat="server"></telerik:RadLabel>
</td>
<td>
<telerik:RadTextBox ID="RadTextBox4" runat="server" Text='<%# Bind("Node") %>'></telerik:RadTextBox>
</td>
</telerik:RadAjaxPanel>
</tr>
</table>
</div>
</ItemTemplate>
</telerik:RadListView>
</div>
</form>
</body>
</html>
Thanks And Regards,
Valli
Hi,
Using the code above I am able to retrieve the RadListView,
But the code var textbox = $telerik.findControl(listview.get_element().parentNode, "RadTextBox1"); is returning null.
Please provide solution.
Thanks,
Swarupa