PDA

View Full Version : [CLOSED] TextField in codebehind



vgvallee
Jul 10, 2013, 5:16 PM
Hi,

I am creating a TextField in codebehind and I run into a few issues:

When I try to set the Vtype, I can't use the following

Vtype = Ext.Net.ValidationType.Email.ToString()
whereas

Vtype = "email"
works.
For other properties on other fields, I can use

Layout = Ext.Net.LayoutType.Fit.ToString()
just fine.

Also, the Validator property is read-only. Is that by design? That means that I can't do this


<ext:TextField
runat="server"
Name="password2"
FieldLabel="Repeat Password"
InputType="Password"
AllowBlank="false">
<Validator Handler="return (value === this.previousSibling('[name=password1]').getValue()) ? true : 'Passwords do not match.';" />
</ext:TextField>

as in the examples...

Another minor thing is the code assist tooltip that pops up in VS when hovering over the Margin property: it says "Specifies the margin for this component. The margin can be a single numeric value to apply to all sides or it can be a CSS style specification for each style, for example '10 5 3 10'.". This property is an int? so it won't accept a string. MarginSpec seems to be the proper way to set the margins with a string so the "...or ....." should be removed.

Thanks,
Vince

Vladimir
Jul 10, 2013, 5:40 PM
When I try to set the Vtype, I can't use the following

It is case sensitive property, please use


Vtype = Ext.Net.ValidationType.Email.ToString().ToLowerInv ariant()

Why don't you want to use StandardVtype property?



Also, the Validator property is read-only. Is that by design?

Yes, Validator already has instance therefore just use it


field.Validator.Handler = "...";




MarginSpec seems to be the proper way to set the margins with a string

Yes, you are right

vgvallee
Jul 10, 2013, 8:05 PM
Most of those questions are because I did not know of those properties. Not all of those are approached in the examples and if they are, they might not be in a category I would think to look at for a particular property. I can't find anything about StandardVtype in the docs at http://docs.ext.net/

For Validator, how would you include it in the following snippet:



new Ext.Net.TextField
{
ID = "confirm",
FieldLabel = "Confirm Password",
AllowBlank = false,
AllowOnlyWhitespace = false,
Plugins =
{
new Ext.Net.PasswordMask
{
}
}
}

Vladimir
Jul 10, 2013, 8:14 PM
For Validator, how would you include it in the following snippet:




Validator =
{
Handler = "...."
}