ali raza

C#, .Net ,Asp.net and my thoughts

Category Archives: asp.net 2

Best advice for your preparation for 70-536

As is known to everyone, if you learn and master each and every aspect of the subject and get a hand on experience on it, and then you will not have any problems, that is to say, you absolutely will get 70-536!!But, we could not become a master in .net framework-application Development Foundation in singe [...]

whats new in asp.net 4.0

read the following link http://www.asp.net/learn/whitepapers/aspnet40/

How to get month date view between two dates in c#

Scenario I got while developing some application. I required month and year view in drop down list between contract starting and ending date. Like “March 2009” “April 2009” until march 2011 so on. I handled it as follow DateTime _LoopDate = “1/1/2009”; string month = string.Empty; DateTime _EndDate = “1/1/2011”; while (_LoopDate <= _EndDate) { [...]

How to get Month name from current date using c#

Hi i found two methods to do so. Using Globliziation System.Globalization.DateTimeFormatInfo d = new System.Globalization.DateTimeFormatInfo(); string month = d.MonthNames[DateTime.Now.Month-1]; Using new date object as follow string MonthName = GetMonthName(DateTime.Now.Month); static string GetMonthName(int monthNum) { return GetMonthName(monthNum, false); } static string GetMonthName(int monthNum, bool abbreviate) { if (monthNum < 1 || monthNum > 12) throw new [...]

Export GridView from aspx page to Pdf using iTextSharp in asp.net

very helpful link i found on internet http://csharpdotnetfreak.blogspot.com/2008/12/export-gridview-to-pdf-using-itextsharp.html

how to send mail smtp with authentication with web.mail class

hi i used following code MailMessage message = new MailMessage(); message.To = “myemailaccount@yahoo.com”; message.From = “myemailaccount@thecrystalrosary.com”; message.Subject = “Testing Internet SmtpMail”; message.BodyFormat = MailFormat.Html; message.Body = “body”; message.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpserver”, “smtp.thecrystalrosary.com”); message.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”, 25); message.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendusing”, 2); //2 to send using SMTP over the network message.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”, 1); //1 = basic authentication message.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendusername”, “username”); message.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendpassword”, “password”); try { SmtpMail.Send(message); } [...]

how to get oracle sequence numbers in .net

hi the main Query to get sequence number is follow select JOB_ID_SEQ.NEXTVAL from dual; i get the required Sequence number value form following method public int GetOracleSequenceValue(string _SequenceValue) { OdbcCommand _command = new OdbcCommand(); int _ItemValue = -1; OdbcConnection _con = new OdbcConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["RCConnectionString"].ToString()); try { _con.Open(); _command.Connection = _con; string _QueryString = “select “+ _SequenceValue [...]

regular expression for email address validation

hi use this regular expression for email address validation ^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$ Regular expression validator in asp.net would be like Chears…

how to insert dateTime in Oracle database using c#

hi all, i have facing problem while Executing Insert query with dataTime on Oracle database. This query is generated by string manuplation using C# at business layer . i fix the date time as in Query “TO_DATE(‘” + ProdMonitor.TRANSACTIONDATE.Month+ “/” + ProdMonitor.TRANSACTIONDATE.Day + “/” + ProdMonitor.TRANSACTIONDATE.Year+ ” ” + ProdMonitor.TRANSACTIONDATE.ToLongTimeString()+ “‘,’mm/dd/yyyy HH:MI:SS PM’),” The Whole [...]

how to get server.mappath in c# class

i face a problem that server.mappath did not available in c# class at my utillity framework at app code folder of one of my asp.net application.  While it is available at asp.net page code behind.  Because ASP.NET pages contain a default reference to the System.Web namespace (which contains the HttpContext class), you can reference the [...]

Follow

Get every new post delivered to your Inbox.