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

RadInput Search Text box fires OnMouse out

3 Answers 157 Views
Input
This is a migrated thread and some comments may be shown as answers.
Doug Thompson
Top achievements
Rank 1
Doug Thompson asked on 06 Apr 2010, 11:55 AM
Hi
I have an input box on my Master page.
The only event to hand is 'OnTextChanged' so I can type something in the text box and hit enter or click the button and it posts back to the code 'Master_Search_TextChanged' however that is also true of moving your mouse out of the box and clinking on another link. The event 'Master_Search_TextChanged' is always fired regardless of ony change in user intention how can you stope this without using classic code of one text box and one button ?
I have tried using Javascript to consume or control events (eg 'DisableOffFocusSearching') as outlined in the code libs but nothing works.
Any suggestions
Doug.


<div class="search FloatFlds">  
<%-- 
<telerik:RadTextBox   
                                  
ID="Master_Search1" ShowButton="true" BorderWidth="0px" ButtonsPosition="Right" 
 EmptyMessage="Search" AutoPostBack="true" CssClass="box-" runat="server" EnableAjaxSkinRendering="true" 
OnTextChanged="Master_Search_TextChanged" AutoCompleteType="Search" BorderStyle="None" 
Width="200px" Skin="WebBlue">  
<ClientEvents OnButtonClick="DisableOffFocusSearching" /> 
</telerik:RadTextBox>
--%> 
 
<div style="float: left; display: inline">  
<asp:TextBox ID="Master_Search" runat="server"   
AutoCompleteType="Search"   
CssClass="box" BorderWidth="0px" Width="179px"></asp:TextBox></div>  
 
<div style="float: right; display: inline">  
<asp:ImageButton ID="LinkButton19" BorderStyle="None" BorderWidth="0px" 
OnClick="Master_Search_TextChanged" 
 ImageUrl="~/App_Themes/t/resources/css/images/buttons-bullets/search_btn.gif" 
runat="server" /></div>  
</div> 
<!-- 

 

function DisableOffFocusSearching(sender, eventArgs) {
if (sender.get_enabled()) sender.disable(); else sender.enable(); } //DisableOffFocusSearching

 

 

 



-->

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 09 Apr 2010, 08:04 AM
Hello Doug,

When you set AutoPostBack="true" for the RadTextBox, it will postback everytime its value is changed by the user. Of course, the TextChanged server event will fire in this case as well.

Probably you don't need to enable AutoPostBack ?

Kind regards,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Doug Thompson
Top achievements
Rank 1
answered on 09 Apr 2010, 09:37 AM
Hi Dimo
I have tried it with "AutoPostBack true and false.
The only event I could capture was 'TextChanged '
What I wanted to do was to have the Button part of the control firing the search.
Ideally I want the OnEnter key and the OnButtonClick to control event firing.
These were not available to me .

I had to use a ASP Input control and an ASP button - the radinput could not do the job when there is the possiblity of other things on the page being clicked.

All this could have been resolbed in the button part of the radInput control had a server side onClick event.

Can you either tell me how to attach such an event or to add it to your requirements list for the next release.

Thanks in advance
Doug(UK)
0
Dimo
Telerik team
answered on 09 Apr 2010, 10:19 AM
Hello Doug,

The RadTextBox button is for implementing client actions and I am afraid it does not have a server click event. You can use something like this:

<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<script runat="server">
 
    protected void RadTextBox1_TextChanged(object sender, EventArgs e)
    {
        Label2.Text = DateTime.Now.ToLongTimeString();
    }
 
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = DateTime.Now.ToLongTimeString();
    }
     
</script>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadTextBox ID="RadTextBox1" runat="server" ShowButton="true" OnTextChanged="RadTextBox1_TextChanged">
    <ClientEvents OnButtonClick="postBack" />
</telerik:RadTextBox>
 
<br /><br /><br />
 
<div style="display:none">
    <asp:Button ID="Button1" runat="server" Text="PostBack" OnClick="Button1_Click" />
</div>
 
 
<br /><br /><br />
 
Button clicked: <asp:Label ID="Label1" runat="server" />
<br /><br />
Text changed: <asp:Label ID="Label2" runat="server" />
 
<script type="text/javascript">
 
function postBack(sender, args)
{
    $get("<%= Button1.ClientID %>").click();
}
 
</script>
 
</form>
</body>
</html>


Kind regards,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Input
Asked by
Doug Thompson
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Doug Thompson
Top achievements
Rank 1
Share this question
or