Friday, 25 October 2013

Host your project in IIS server as well as Intranet

Step by step process to host your site in IIS as well as Local Internet:


On IIS:
·         Run your project as Administrator in visual studio.
             Go to the property of you application

·       
             In Web tab select ‘Use Local IIS Web Server’

·         Give Project URL and Click on "Create Virtual Directory’ button
·        

 Now open Run (window+R) write ‘inetmgr’ to open your IIS Server


On Connections Refresh Default Web Site. Your Web Site is Present on here


·                          Browser your site.



             Copy your Site and Run Any Where into Local Intranet. That’s it.
   On Local Internet:
            for local internet just do given step....
‘Control Panel\All Control Panel Items\Windows Firewall\Allowed Programs’
And follow this step


Wednesday, 23 October 2013

Run your Project properly in Internet Explore


If Your Code is not running properly in Internet Explorer, then Write Some Script which is given by googlecode.com:

 <!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE6.js"></script>
<![endif]-->


that's it...

Tuesday, 22 October 2013

Custom validation with ASP.NET validator for max date and min date

Hello Friends,
you want to validate any text box as a minimum and maximum date, then use below code.

Step 1: A Custom Validator add in .aspx page

<asp:TextBox ID="txtDOJ" runat="server" PlaceHolder="Date of Journey"></asp:TextBox>
<asp:CustomValidator runat="server" ID="valDateRange" ControlToValidate="txtDOJ"
OnServerValidate="valDateRange_ServerValidate" ErrorMessage="enter valid date" />

Step 2: Code-behind .cs page

protected void valDateRange_ServerValidate(object source, ServerValidateEventArgs args)
        {
            DateTime minDate = DateTime.Parse(DateTime.Now.ToLongDateString());
            DateTime maxDate = DateTime.Parse(DateTime.Now.AddMonths(2).ToLongDateString());
            DateTime dt;

            args.IsValid = (DateTime.TryParse(args.Value, out dt)
                            && dt <= maxDate
                            && dt >= minDate);
        }


that's it...

Search on This Blog