Hi All,
I am using RadToolTip control and under that I have place a textbox control when a user click on a radtooltip I would like to set the focus on a textbox control. For some reason I am not able to that. Please look at the code below and advise me anything which might be useful for me.
I am getting the textNote ID but for some reason when I call the focus method it doesn't set the focus.
Thanks for your response in advance.
I am using RadToolTip control and under that I have place a textbox control when a user click on a radtooltip I would like to set the focus on a textbox control. For some reason I am not able to that. Please look at the code below and advise me anything which might be useful for me.
I am getting the textNote ID but for some reason when I call the focus method it doesn't set the focus.
Thanks for your response in advance.
<script type="text/javascript"> function SetFocusToTextBox(txt) { var txtNote = document.getElementById(txt); alert(txtNote); txtNote.focus(); } </script><telerik:RadGrid ID="gvTopics" runat="server" Font-Names="Verdana" Font-Size="XX-Small" Skin="Office2007" EnableEmbeddedSkins="true" GridLines="Both" AllowSorting="true" AllowPaging="true" PageSize="10" Width="99%" CellPadding="2" AutoGenerateColumns="False"> <MasterTableView CommandItemDisplay="Top"> <CommandItemSettings ShowAddNewRecordButton="false" RefreshImageUrl="" /> <Columns> <telerik:GridTemplateColumn> <ItemTemplate> <asp:ImageButton ID="btnShowMessagesFromTopicList" ToolTip="Show messages" runat="server" CommandArgument='<%# Container.DataItem("id")%>' Text="show msgs" OnClick="btnShowMessagesFromTopicList_Click" /> <asp:ImageButton ID="btnAddMessage" runat="server" ToolTip="Reply to agent" Text="Reply" CommandArgument='<%# Container.DataItem("id")%>' OnClick="btnReply_Click" /> <asp:ImageButton ID="btnAddNote" runat="server" Text="Add Note" CommandArgument='<%# Container.DataItem("id")%>' /> <asp:ImageButton ID="btnCloseTopic" runat="server" Text="close" Visible="false" CommandArgument='<%# Container.DataItem("id")%>' OnClick="btnCloseTopic_Click" ToolTip="Close topic" /> <asp:HiddenField ID="hidID" Value='<%# Bind("ID") %>' runat="server" /> <asp:HiddenField ID="hidCreatedBy" Value='<%# Bind("CreatedBy") %>' runat="server" /> <asp:HiddenField ID="hidNewAgentMessage" Value='<%# Bind("NewAgentMessage") %>' runat="server" /> <telerik:RadToolTip ID="rttpNote" Width="210" Height="200" HideEvent="ManualClose" TargetControlID="btnAddNote" RelativeTo="Element" Skin="Windows7" Position="TopRight" ManualClose="true" ShowEvent="OnClick" runat="server"> <table width="100%"> <tr> <td> Notes : <asp:TextBox ID="txtNote" TextMode="MultiLine" Width="200" Height="200" onblur runat="server"></asp:TextBox> </td> </tr> <tr> <td> <asp:Button ID="btnSaveNote" CommandArgument='<%# Container.DataItem("id")%>' Text="Save" OnClick="btnSaveNote_Click" runat="server" /> </td> </tr> </table> </telerik:RadToolTip> </ItemTemplate> <ItemStyle Width="15%" /> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid>
Protected Sub gvTopics_OnItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles gvTopics.ItemDataBound
If TypeOf (e.Item) Is GridDataItem Then
Dim txtNote As TextBox = e.Item.FindControl("txtNote")
btnAddNote.Attributes.Add("onClick", "javascript:SetFocusToTextBox('" & txtNote.ClientID & "')")
End Sub