This is a migrated thread and some comments may be shown as answers.

how to access user control by javascript

1 Answer 148 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Muhammad
Top achievements
Rank 1
Muhammad asked on 04 Apr 2012, 02:34 PM

i have a user control with rad tool bar button like this

<telerik:RadToolBar ID="RadToolBar1" Runat="server" 
EnableRoundedCorners="True" EnableShadows="True" Width="940px" 
onbuttonclick="RadToolBar1_ButtonClick" onunload="RadToolBar1_Disposed">
<Items>
<telerik:RadToolBarButton CommandName="btn" Text="Add" ImageUrl="../Images/Add.png" 
ImagePosition="AboveText" />
<telerik:RadToolBarButton Text="Update" ImageUrl="../Images/Edit.png" ImagePosition="AboveText" />
<telerik:RadToolBarButton Text="Delete" ImageUrl="../Images/Delete.png" 
ImagePosition="AboveText" />
<telerik:RadToolBarButton Text="Refresh" ImageUrl="../Images/Refresh.png" ImagePosition="AboveText" />
<telerik:RadToolBarButton Text="Print" ImageUrl="../Images/Print.png" 
ImagePosition="AboveText" Enabled="False" />
<telerik:RadToolBarButton Text="Close" ImageUrl="../Images/Close.png" 
ImagePosition="AboveText" />
<telerik:RadToolBarButton Text="Save As" ImageUrl="../Images/SaveAs.png" 
ImagePosition="AboveText" />
<telerik:RadToolBarButton Text="Itemtemplate">
<ItemTemplate>
<div id="loginAarea" style="margin-left:150px" >
<table style="margin-left: -50px;" >
<tr>
<td >
<telerik:RadTextBox ID="txtUserName" runat="server" Label="Added By" 
Width="240" Height="16" Enabled="false" Font-Bold="True" ></telerik:RadTextBox>
</td>
<td>
<telerik:RadTextBox ID="txtLastUserName" runat="server" 
Label="Last Updated By" Width="240" Height="16" Enabled="false" 
Font-Bold="True" ></telerik:RadTextBox>
</td>
</tr>
<tr>
<td>
<telerik:RadTextBox ID="txtLoginDate" runat="server" Label="Date:" 
Width="240" Height="16" Enabled="false" Font-Bold="True" ></telerik:RadTextBox>
</td>
<td>
<telerik:RadTextBox ID="txtLastLoginDate" runat="server" Label="Date:" 
Width="240" Height="16" Enabled="false" Font-Bold="True" ></telerik:RadTextBox>
</td>
</tr>
</table>
</div>
</ItemTemplate>
</telerik:RadToolBarButton>

</Items>
</telerik:RadToolBar>

i add the rad tool bar with place holder on content page like this

Page.LoadControl("MenuStyle1.ascx");
Spinner1 = (ASP.MenuStyle1)LoadControl("MenuStyle1.ascx");
RadToolBar tlbar = (RadToolBar)Spinner1.FindControl("RadToolBar1");
place.Controls.Add(tlbar);

<asp:PlaceHolder ID="place" runat="server"></asp:PlaceHolder>

now i want to access the radtoolbar using javascript how i do that

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Apr 2012, 10:18 AM
Hello Muhammed,

Try setting the ClientIDMode property of RadToolBar to Static and access the Toolbar like
JS:
document.getElementById("ctl00_MainContent_RadToolBar1")

Thanks,
Princy.
Tags
General Discussions
Asked by
Muhammad
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or