Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have combobox Incidenttype(label of combobox) in my application in which i am doing the validation like if someone has not chosen anything in the combobox,it will throw exception that IncidentType Input is not in correct format.

I want to change the Exception message to Please Selcet value in Incident type.
Below is my code .

Xaml

<toolkit:datafield isrequired="True" label="Incident Type" verticalalignment="Center" xmlns:toolkit="#unknown">
<simstagcombobox verticalalignment="Center" horizontalalignment="Left" height="25" width="220" tagtypeid="9" selectedvalue="{Binding IncidentType, Mode=TwoWay }">

Code:
Public Property IncidentType As Guid
Get
Return _guid1
End Get
Set(value As Guid)
_guid1 = value
End Set
End Property

Please provide some solution it very urgent.
Posted
Updated 26-Jun-13 2:48am
v3

1 solution

Hi,
Check the value before set. Below is the code sample

private IncidentType guid;
public IncidentType Guid
{
get
{
return guid;
}
set
{
if (value == null)
{
throw new Exception(Please Select value in Incident type.);
}
/* set the value here */
}
}
 
Share this answer
 
v2
Comments
richa11 27-Jun-13 1:46am    
I have already tried it .but if we dont select any thing in combobox set doesn't hit because I am binding through selectedvalue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900