• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

Positive Validation?

I'm using the validation controls in .NET to make sure my data is entered right.  So far, so good.  However, I'm wondering if it's possible to tell the user that a record has been updated using the validation controls.  In other words, if the user enters everything right for a new salesman, for example, could I use the validation controls to say, "Salesman Entered", or at least write a message like that to the summary control?
0
Remulac
Asked:
Remulac
  • 2
  • 2
2 Solutions
 
gregasmCommented:
I don't think you should use the validation control to notify the user.

The reason is because when the error text property is set, then the control will fail validation.

May I suggest other ways to notify the user:  Either the StatusBar, or a modal form that becomes visible and displays the message to the user, and then goes away. Another way is to use something like MSN Messenger. Have you seen those notification forms pop up in the bottom right corner of the screen when someone logs on and off? This is the same concept as what I am suggesting above.

You might also want to allocate some space on yoru form for a status textbox and post the messages to that. How about a listbox, and when new messages are needed, then add an item to the listbox. This way you can keep a history of the messages...

Obcviously, I don't know your requirements and I am just throwing out suggesting that may or may not apply. The bottom line is, The validation control is not the right control for your needs.

Let me know if you need more pointers or usability tips.

GL
0
 
RejojohnyCommented:
as gregasm mentined, u cannot use the validation control to show the message ..
>>could I use the validation controls to say, "Salesman Entered",
This could be done using a label within ur form and making in invisible at the start.. when the record is updated, use (in ur code-behind)
UrLabel.text = "Salesman Entered"
UrLabel.visible = true

>>or at least write a message like that to the summary control?
for this u could render a script after the data is updated
write this code after the data is successfully updated - in ur code-behind

Dim lstrScript as string
lstrScript += lstrscript & "<script language=javascript>" & vbcrlf
lstrScript += lstrscript & "alert('Salesman Entered');" & vbcrlf
lstrScript += lstrscript & "</script>
RegisterClientScriptBlock("MyMessage", lstrScript)


0
 
Type25Commented:
You could always raise a message box, like so:

if (successfullyUpdated == true)
{
    Page.RegisterClientSideScript("success", "<script>alert('Successfully updated employee');</script>");
}
0
 
RejojohnyCommented:
Type25,
i do think there is any member called "RegisterClientSideScript" to the page class .. if u meant "RegisterClientScriptBlock" then how is it different from what i suggested? ...
0
 
Type25Commented:
Very true, sorry didn't read your response before posting mine!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now