Is there a way to get the client object of rad control withing the div? I have a div with class="extension" I can get hold of div using jquery. Now I want to $find all different radcontrol in that div and modify using client methods.. .. I cannot use if because they are within listview | raddockzone | custom usercontrol | div with class
3 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 04 Dec 2013, 03:38 AM
Hi Chetan,
Please have a look into the following code snippet to access the Client Side object of RadControls with in the div with class.
ASPX:
JavaScript:
Let me know if you have any concern.
Thanks,
Princy.
Please have a look into the following code snippet to access the Client Side object of RadControls with in the div with class.
ASPX:
<div class="extension" runat="server"> <telerik:RadTextBox ID="RadTextBox1" runat="server" Text="Text1"> </telerik:RadTextBox> <telerik:RadButton ID="RadButton1" runat="server" Text="Button1"> </telerik:RadButton></div>JavaScript:
<script type="text/javascript"> function pageLoad() { var textbox = $find("<%=RadTextBox1.ClientID %>"); alert("TextBox " + textbox.get_value()); var button = $find("<%=RadButton1.ClientID %>"); alert("Button " + button.get_text()); }</script>Let me know if you have any concern.
Thanks,
Princy.
0
Chetan
Top achievements
Rank 1
answered on 04 Dec 2013, 02:52 PM
Thanks Princy,
Is there any other way to get the client object without using the clientID? I dont have accesss to clientID becuase these RadTextBox and RadButton are in userControl for a good reason.
here is the code snippet:
Is there any other way to get the client object without using the clientID? I dont have accesss to clientID becuase these RadTextBox and RadButton are in userControl for a good reason.
here is the code snippet:
<div class="extension"> <uc:UCFormExt runat="server" ID="UCFormExt1" /></div>In usercontrol UCFormExt I have defined textbox, combobox, and radbutton.So I cannot use <% =textbox1.ClientID%> because it is repeated on page mulitple times because it is in RadListView!0
Princy
Top achievements
Rank 2
answered on 05 Dec 2013, 05:36 AM
Hi Chetan,
Please have a look into the following code snippet to achieve your scenario.
ASPX:
ASCX:
ASCX JavaScript:
Thanks,
Princy.
Please have a look into the following code snippet to achieve your scenario.
ASPX:
<div class="extension"> <uc1:WebUserControl2 ID="WebUserControl21" runat="server" /></div>ASCX:
<telerik:RadListView runat="server" ID="RadListView1" AllowPaging="True" DataKeyNames="CustomerID" DataSourceID="SqlDataSource1"> <LayoutTemplate> <table> <thead> <tr> <th> CustomerID </th> </tr> </thead> <tbody> <tr id="itemPlaceholder" runat="server"> </tr> </tbody> </table> </div> </LayoutTemplate> <ItemTemplate> <tr> <td> <asp:Label ID="CustomerIDLabel" runat="server" Text='<%# Eval("CustomerID") %>'></asp:Label> </td> <td> <telerik:RadTextBox ID="CompanyNameTextBox" runat="server" Text='<%# Bind("CompanyName") %>'> </telerik:RadTextBox> </td> </tr> </ItemTemplate></telerik:RadListView><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [CustomerID], [CompanyName] FROM [Customers]"></asp:SqlDataSource>ASCX JavaScript:
<script type="text/javascript"> function pageLoad() { //access the first textbox in the radlistview. var textbox = $find('<%=((RadTextBox)RadListView1.Items[0].FindControl("CompanyNameTextBox")).ClientID%>'); }</script>Thanks,
Princy.