Wednesday, March 11, 2009

disable scroll bar

In some cases we would like to disable the scroll bar on the page in that case we can use the following lines in the appropiate section of the .aspx page. the code is as follows

[code]

< body style="overflow: hidden" >



[style type="text/css"]

body {
overflow-x: hidden;
overflow-y: scroll;
}

[/style]

[code]

Note: That all browsers doest not support this method (for instance IE for Mac still shows the scrollbars).

in my next article i will post the code how to handle those browsers...

Thanks and Regards
Meetu Choudhary
Founder http://www.msdotnetmentor.com

Tuesday, March 10, 2009

Show or Hide combobox at Runtime using JavaScript

Show or Hide combobox at Runtime using JavaScript

Many a times in the programming world we feel the need to hide or show the dropdown lists or combo boxes of the particular page or a div or anyother control so here is a small snippet

The Following is the JavaScript function to achieve the above you can embede it in any external JavaScript file or write as an inline script or include in the head section...


function showOrHideAllDropDowns(newState)
{

var elements = document.documentElement.getElementsByTagName('select');

for (var i=0; i
elements[i].style.visibility = newState;
} }




To use the Above function in a div we can write it like


< style="width:220px;" onmouseover="showOrHideAllDropDowns('hidden');" onmouseout="showOrHideAllDropDowns('visible');">





Thanks and Regards
Meetu Choudhary
Founderhttp://msdotnetmentor.com

Saturday, March 7, 2009

Sending Email Through ASP.NET using C#

The following Sample Code is the code which can be used to send mails through ASP.Net C#.... its a working code for me.....

[code]
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.
WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;

public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//Calling the function SendMail
Response.Write( SendMail("meetuchoudhary@gmail.com","meetudmeet@gmail.com","meetudmeet@yahoo.com","Test Mail","Test Mail Body"));
}

public string SendMail(string toList, string from, string ccList, string subject, string body)
{
MailMessage message = new MailMessage();
SmtpClient smtpClient = new SmtpClient();
string msg = string.Empty;
try
{
MailAddress fromAddress = new MailAddress(from);
message.From = fromAddress;
message.To.Add(toList);
if (ccList != null && ccList != string.Empty)
message.CC.Add(ccList);
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
smtpClient.Host = "mail.server.com";
smtpClient.Port = 25;
smtpClient.UseDefaultCredentials = true;
smtpClient.Credentials = new System.Net.NetworkCredential("info@server.com", "password");

smtpClient.Send(message);
msg = "Successful";
}
catch (Exception ex)
{
msg = ex.Message;
}
return msg;
}

}
[/code]


--
Thanks and Regards
Meetu Choudhary

Overview of ASP.Net Framework

ASP.NET and the .NET Framework

ASP.NET is part of the Microsoft .NET Framework. To build ASP.NET pages, you need to take advantage of the features of the .NET Framework. The .NET Framework consists of two parts: The Framework Class Library (FCL) & The Common Language Runtime (CLR).

Understanding the Framework Class Library

The .NET Framework contains thousands of classes that you can use when building an application. The Framework Class Library was designed to make it easier to perform the most common programming tasks.
Some Examples are

File class Enables you to represent a file on your hard drive.

Graphics class Enables you to work with different types of images such as GIF, PNG, BMP, and JPEG images.

These are some examples of classes in the Framework. The .NET Framework contains almost 13,000 classes you can use when building applications.

You can view all the classes contained in the Framework by opening the Microsoft .NET Framework SDK documentation and expanding the Class Library node

Subscribe via email

Enter your email address:

Delivered by FeedBurner

MSDotnetMentor

MSDotnetMentor My Website http://msdotnetmentor.com