my scenario is, if user put focus on text in WebDropDown, then text should be highlighted and when he click on Backspace button on keyboard, then text value should disappear.
i am working in .NET and i want to implement this functionaliy in Javascript or JQuery.
How to do it ??
Hi snohig_07,
I am following up to check whether you are still experiencing any issues. Please contact me if you need further assistance.
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support
I can see no issues with the code you have provided.
After some more research, it seems that your desired functionality requires a more customized approach due to the design of the WebDropDown. You can try adding a handler for the input element's OnMouseUp event in the dropdown's Initialize event and using a minor timeout.
For instance:
function WebDropDown1_Initialize(sender, eventArgs){ ig_controls.WebDropDown1._elements["Input"].onmouseup = myfunction;}function myfunction() { setTimeout("select();",1);}function select() { ig_controls.WebDropDown1._elements["Input"].select();}
Attached is my test sample.
Please do not hesitate to contact me if you have any questions.
Best Regards,Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support
Hi Petar,
i tried but its not happening. Please find the code below
----JS code----
<script type="text/javascript">
function wddFocus_Focus(sender, eventArgs)
{
sender._elements["Input"].selectionStart = 0;
sender._elements["Input"].selectionEnd = sender._elements["Input"].value.length;
}
</script>
----.ASPX code----
<igWebDropDown:WebDropDown ID="wddFocus" runat="server"
Width="200px"
TextField="FirstName" ValueField="Id">
<ClientEvents Focus="wddFocus_Focus" />
<DropDownItemBinding TextField="FirstName" ValueField="FirstName" />
</igWebDropDown:WebDropDown>
----C# code----
DataSet SongDS = new DataSet();
protected void Page_Load(object sender, EventArgs e)
DataTable songTable = SongDS.Tables.Add();
//-- Add columns to the data table
songTable.Columns.Add("FirstName", typeof(string));
//-- Add rows to the data table
songTable.Rows.Add("Diary of Jane");
songTable.Rows.Add("Pain");
songTable.Rows.Add("Fake It");
songTable.Rows.Add("Paralyzer");
songTable.Rows.Add("Citizen Soldier");
this.wddFocus.DataSource = SongDS;
this.wddFocus.DataBind();
In order to highlight the text in the WebDropDown's input, you can handle the Focus client-side event and use the following javascript code:
function WebDropDown1_Focus(sender, eventArgs) { sender._elements["Input"].selectionStart = 0; sender._elements["Input"].selectionEnd = sender._elements["Input"].value.length;}
You can find more information regarding the WebDropDown in our documentation at:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.1/CLR4.0/?page=Web_WebDropDown.html
Please feel free to contact me if you have any questions.