How to show div vertical/horizontal scroll

Hello All,

All we know that by overflow property we can handle overflow of element. Sometime we want overflow only vertical or horizontal. To achieve this we can set overflow-x and overflow-y.

/* For vertical scroll */
scroll text....scroll text....scroll text....scroll text....scroll text....scroll text....scroll text.... scroll text....scroll text....scroll text....scroll text....scroll text....scroll text....scroll text....
/* For horizontal scroll */
scroll text....scroll text....scroll text....scroll text....scroll text....scroll text....scroll text.... scroll text....scroll text....scroll text....scroll text....scroll text....scroll text....scroll text....

Here white-space is also important to set overflow. With white-space we can set wrap and nowrap default white-space is wrap or normal.

Hope it will help someone.

Age validation in asp.net

Hello Friends,

Recently i have requirement to validate sign up age +18. I have search many sites to how it will calculate age on date. I found simple RangeValidator to accomplish this.


Now, in back end set RangeValidator minimum date and maximum date. To set it use following

rvDOB.MinimumValue = DateTime.Today.AddYears(-60).ToString("MM/dd/yyyy");
rvDOB.MaximumValue = DateTime.Today.AddYears(-18).ToString("MM/dd/yyyy");

You can set your years in AddYears as per your requirement. Hope it will help you!!!

how to call server side button event in jquery dialog

Hi All,

Generally we are using jquery modal dialog for modal popup window in our application.

Sometimes we need to call server side button event from modal popup window and it creates problem for us.

Today I am going to describe how can we call asp.net button event from jquery modal popup window.

lets take an simple example:

Asp.Net Button Code:



Jquery Modal Popup Script:


 

Code Behind Button Event:


protected void Button1_Click(object sender, EventArgs e)
{
    //your button click event code comes here
    //you can do anything here
}

Please note that you need to add jquery modal popup related script reference in your code.

how to send attachment in asp.net mail

Hello Friends,

I have write an article on mail sending functionality but i didn’t add attachment in it.
You can check it from here

Today I am going to describe how to send attachment in mail using asp.net
see the below code for mail attachment functionality:


    MailMessage Msg = new MailMessage();  
    Attachment attchment = new Attachment(physicalfilepathcomeshere);
    Msg.Attachments.Add(attchment);
    Msg.From = new MailAddress("fromemailaddress");  
    Msg.To.Add("toemailaddress");  
    Msg.Subject = "Define your subject line";  
    Msg.Body = "Content of body";  
  
    SmtpClient smtp = new SmtpClient();  
    smtp.Host = "smtp.gmail.com";  
    smtp.Port = 587;  
    smtp.Credentials=new System.Net.NetworkCredential("gmailID","gmailpassword");  
    smtp.EnableSsl = true;  
    smtp.Send(Msg);  

you need to provide physical file path in place of “physicalfilepathcomeshere”.

Hope this will help you in sending mail attachment.

IE11 and __doPostBack is undefined

Hi Friends,

Today I have experienced one strange issue on my project. In my local machine everything is working fine but when I have uploaded it on server then it gives me an error.

I have tested it in other browsers and everything going fine but when I tested it on IE11 then it raise the __dopostback error.

I got one link from microsoft regarding this error http://support.microsoft.com/kb/2836939/en-us.

I have updated .net framework version 4 and it solves my problem.

Hope this will also help you !!!

How to validate alphanumeric password in asp.net

Hi Friends,

In my previous post, we have seen asp.net custom validator example.
Now today I am going to describe asp.net RegularExpression validator control.

I have taken simple example for this validation. you can validate different things by using this control like email validation, special character validation, alphanumeric validation etc.

Lets see how can we validate alphanumeric password with minimum 5 characters long.

Password Textbox:


RegularExpression Validator:


Button:


now when I click on the button then it validates the password textbox whether user enters it as alphanumeric or not

Hope this will help you !!!….