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

I am working with a web based application with sql server 2005 database.It contain one page for branch timing.In this 2 text boxes are there to enter 'intime' and 'outtime'.To become time format masked edit extender and Masked edit validator is used with text boxes as below..

XML
<asp:TextBox ID="txt_MinTime" runat="server" CssClass="TextBox_Normal"
                                               Width="120px">

                                               <cc1:MaskedEditExtender ID="MaskedEditExtender6"  runat="server" Mask="99:99" MaskType="Time" AcceptAMPM="true"
                                   MessageValidatorTip="true"  TargetControlID="txt_MinTime">


                               <cc1:MaskedEditValidator ID="mv1"  runat="server" ControlExtender="MaskedEditExtender6" ControlToValidate="txt_MinTime"
                                    EmptyValueMessage="Time is required" InvalidValueMessage="Valid In Time" IsValidEmpty="true" TooltipMessage="Input a time">




now the textbox appearance is like this 07:00 PM.
The 07:00 PM will be saved in the database as 19.00 in decimal.The insertion is success.

I am also want to edit the Branch time.So that i changed the time to AM Pm format .During the retrieve time all controls are filled with corresponding data.The text box with masked editvalidator/extender are not filled with any data.It is empty.

How can i fix this problem?If you can please help me....


with regards
shamsi
Posted

1 solution

decimal intime=Convert.ToDecimal(dr["intime"]);
if(intime>12)
{
txt_MinTime.Text=(intime-12).ToString()+"PM";
}
else
{
txt_MinTime.Text=intime.ToString()+"AM";
}
 
Share this answer
 

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