New Posts New Posts RSS Feed: Validation on TextBox
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Validation on TextBox

 Post Reply Post Reply Page  12>
Author
bala View Drop Down
Groupie
Groupie
Avatar

Joined: 18-Aug-2010
Location: Brazil
Posts: 54
Post Options Post Options   Quote bala Quote  Post ReplyReply Direct Link To This Post Topic: Validation on TextBox
    Posted: 02-Sep-2010 at 11:11am
Hi
 
I am inserting data after entering on TextBox
 
I want to validiate that text box...
 
How can I do with DevForce.?
 
I am using Devforce200V 6.0.4.0 With Silverlight
 
 
Waiting for help
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 06-Sep-2010 at 4:16pm
Hi Bala;

You just need to bind the TextBox to the Entity's property and set NotifyOnValidationError=true. 

For example, using our NorthwindIB Database example, to bind a TextBox to the Employee.City property, the XAML file would look like this:

Text="{Binding City, Mode=TwoWay, NotifyOnValidationError=true}"

Hope this helps.

Denis
Back to Top
bala View Drop Down
Groupie
Groupie
Avatar

Joined: 18-Aug-2010
Location: Brazil
Posts: 54
Post Options Post Options   Quote bala Quote  Post ReplyReply Direct Link To This Post Posted: 08-Sep-2010 at 7:30am
Hi

I am using master details method I am showing data on grid  and after selecting a grid
his details showing on textbox.

Now i want to update data and I want validation on it. and want to fire proper error message too.

Mention code is not fireing any message.

Thanks
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 08-Sep-2010 at 2:57pm
Bala;

How are you binding your UI control and Data Context?
Back to Top
bala View Drop Down
Groupie
Groupie
Avatar

Joined: 18-Aug-2010
Location: Brazil
Posts: 54
Post Options Post Options   Quote bala Quote  Post ReplyReply Direct Link To This Post Posted: 09-Sep-2010 at 4:28am
Hi Denisk

This is how I am getting records on Datagrid

public ObservableCollection<STUDENT> Students { get; private set; }
             var query = _mgr.STUDENTs;
              query.ExecuteAsync(op => { op.Results.ForEach(Students.Add);}, null);

Like this I am showing details with Clicking on Data grid
private void StudentGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (StudentGrid.SelectedItem == null)
            {
                return;
            }
            else
            {
              StudentSorders   aa = (StudentSorders)StudentGrid.SelectedItem;
                _id = aa.ID;
               txtName.Text = aa.NOME;
            }
        }
Here after diplaying record on txtbox i am doing add/delete/ update operation and this time
i need validation.

private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
                    STUDENT stud = Students.Where(t => t.ID == Convert.ToDecimal(_id)).Single();
                    stud.NAME = txtName.Text;
                    StudentGrid.ItemsSource = Students;
                    _mgr.SaveChangesAsync();
        }

Thanks
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 10-Sep-2010 at 10:55am
Have you implemented an IVerifierProvider interface anywhere inside your class?
Back to Top
bala View Drop Down
Groupie
Groupie
Avatar

Joined: 18-Aug-2010
Location: Brazil
Posts: 54
Post Options Post Options   Quote bala Quote  Post ReplyReply Direct Link To This Post Posted: 10-Sep-2010 at 10:58am
No..
I did not implemented any manual code
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 10-Sep-2010 at 11:01am
I see. There is a section on our Wiki that describes how to implement Data Verification with DevForce. Here is the link


That should help you get started.
Back to Top
bala View Drop Down
Groupie
Groupie
Avatar

Joined: 18-Aug-2010
Location: Brazil
Posts: 54
Post Options Post Options   Quote bala Quote  Post ReplyReply Direct Link To This Post Posted: 10-Sep-2010 at 11:10am
I already been went thru this page
This validation work only on Data form or grid...
How can I populate error on text box.

Thanks
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 10-Sep-2010 at 2:36pm
I've created a simple solution that should help you get started. Please click the link below to download.

http://wikisend.com/download/445970/SilverlightApplication1.zip
Back to Top
bala View Drop Down
Groupie
Groupie
Avatar

Joined: 18-Aug-2010
Location: Brazil
Posts: 54
Post Options Post Options   Quote bala Quote  Post ReplyReply Direct Link To This Post Posted: 13-Sep-2010 at 4:33am
Hey Denisk

Thanks for your sharing but this file is corrupted and not able to open in my side
would you like to share again..


Thanks
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 13-Sep-2010 at 12:56pm
Please try again with this link:

http://wikisend.com/download/867508/SilverlightApplication1.zip
Back to Top
bala View Drop Down
Groupie
Groupie
Avatar

Joined: 18-Aug-2010
Location: Brazil
Posts: 54
Post Options Post Options   Quote bala Quote  Post ReplyReply Direct Link To This Post Posted: 13-Sep-2010 at 1:52pm
Hi
Thanks example looking cool
I am try to running but I have one error

 public class NoNumberVerifier : PropertyValueVerifier
            {

                public NoNumberVerifier(Type pType, string propertyName, string displayName = null, bool? shouldTreatEmptyStringAsNull = null)
                    : base(new PropertyValueVerifierArgs(pType, propertyName, false, displayName, shouldTreatEmptyStringAsNull))// error line
                {

           
             

            }

Error    1    'IdeaBlade.Validation.PropertyValueVerifierArgs' does not contain a constructor that takes 5 arguments    C:\Users\vend\Documents\Visual Studio 2010\Projects\DevF\ValidDensk\ValidDenskWeb\Student.cs    38    28    ValidDenskWeb


Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 13-Sep-2010 at 2:46pm
Please update to the latest 6.0.5 version.
Back to Top
bala View Drop Down
Groupie
Groupie
Avatar

Joined: 18-Aug-2010
Location: Brazil
Posts: 54
Post Options Post Options   Quote bala Quote  Post ReplyReply Direct Link To This Post Posted: 14-Sep-2010 at 9:11am
HI Denisk

I could not found any upgrade version of Devforce.
Where I can find new version?

Thanks
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 14-Sep-2010 at 10:29am
If you go to our website, the new version should be up there under the product page.
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down