Oct 27, 2017, 5:45 PM
Adding QTip to FieldLabel Image of TextField
Hello,
I would like to add a QTip to an image that i have added to the "FieldLabel" property of the TextField. I cannot seem to get it to work. I have also tried to use the TextField's "AddScript" method but it does not seem to run. I would like the exclamation icon shown below to display the QTip on mouseover.
The following code is how i create the textfield in code behind and the sample project can be found at https://drive.google.com/open?id=0B7...2IwQjJMbnZacGM
I would like to add a QTip to an image that i have added to the "FieldLabel" property of the TextField. I cannot seem to get it to work. I have also tried to use the TextField's "AddScript" method but it does not seem to run. I would like the exclamation icon shown below to display the QTip on mouseover.
The following code is how i create the textfield in code behind and the sample project can be found at https://drive.google.com/open?id=0B7...2IwQjJMbnZacGM
public Ext.Net.TextField TextFieldForUserName
{
get
{
try
{
Ext.Net.TextField oTextField
= new Ext.Net.TextField
{
LabelAlign = Ext.Net.LabelAlign.Top ,
MinWidth = 260 ,
FieldLabel = "User Name" ,
InputType = Ext.Net.InputType.Text ,
StandardVtype
= Ext.Net.ValidationType.AlphaNum ,
VtypeText = "This field is required." ,
PaddingSpec = "20 20 20 20"
};
string sIconName = Ext.Net.ResourceManager.GetIconClassName ( Ext.Net.Icon.Exclamation );
oTextField.FieldLabel
+= @"  <img id='TestImage' src='/Images/Exclamation16x16.png' width:16px;height:16px;' />";
oTextField.AddScript
( @"(function(){var oElement = Ext.get('TestImage'); window.alert(oElement);Ext.create( 'Ext.tip.ToolTip',{target: oElement , html: 'Here is some help text about this!'})})();" );
Ext.Net.FieldTrigger oFieldTrigger
= new Ext.Net.FieldTrigger
{
IconCls = Ext.Net.ResourceManager.GetIconClassName ( Ext.Net.Icon.Information ),
QTip = "This is information."
};
oTextField.Triggers.Add ( oFieldTrigger );
return oTextField;
}
catch ( System.Exception ex )
{
System.Diagnostics.Debug.Fail ( ex.Message );
throw ex;
}
}
}