about 1 year ago - No comments
Hi Guys, I am reading more on design patterns from this article after little theory session here is working code. Key point was all of the collection classes in the System.Collections namespace, as well as arrays, implement IEnumerable and can therefore be iterated over. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 {
about 1 year ago - No comments
Hi folks, Well I am investigating design patterns by reading an article so after reading a bit I thought it would be nice if I write some code and test it. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { /// <summary> /// Product Class /// </summary> public class Product
about 1 year ago - No comments
I was reading how to write events for your custom classes so after reading a little I thought give it a shot and created this sample code. Below code is using Product class with event and delegate for event handling and other class named Test is using this class and manipulate product class data. If
about 1 year ago - No comments
These parts are taken from msdn and some might be taken from other websites. An interface can inherit from one or more base interfaces. When a base type list contains a base class and interfaces, the base class must come first in the list. A class that implements an interface can explicitly implement members of
about 2 years ago - No comments
hey guyz finally we have to learn how to update our tables in database so only for you guys here is my sample code string giftId = GridView1.SelectedRow.Cells[0].Text.ToString(); //getting an id SqlDataSource myDbSource = new SqlDataSource(); myDbSource.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; //myDbSource.InsertCommand = “update gifts set giftActivate=1 where giftId=” + Entrydate + “)”; myDbSource.UpdateCommand = “update gifts
about 2 years ago - 1 comment
Hey guyz today i will show you how to fire delete query by using our beloved control sqldatasource. Here is the code SqlDataSource myDbSource22 = new SqlDataSource(); myDbSource22.ConnectionString = ConfigurationManager.ConnectionStrings["lalConnectionString"].ConnectionString; myDbSource22.ProviderName = “System.Data.SqlClient”; myDbSource22.DeleteCommand = “delete from ProductsGroups where pid = ” + productId; myDbSource22.Delete(); All it does it deletes all the rows for a
about 2 years ago - 1 comment
hey guyz how are you ?? Me back with my sqldatasource series. Today i will show you how to fire insert query using sqldatasource control into code behind i am using c#. Below is the sample code UserID is the parameter passing into a function as an argument. DateTime Entrydate = DateTime.Today; SqlDataSource myDbSource =
about 2 years ago - 3 comments
hi guyz Sorry for writing after such a long time i guess i am very busy now a days so for a project i needed to read my smtp email settings defined in my web.config file so after some efforts i am able to read these settings direct from my system .net section. System.Configuration.Configuration config
about 2 years ago - No comments
If you want to know only the directory name not the full path of the page that is currently displaying you can use this code string sPath = System.Web.HttpContext.Current.Request.Url.AbsolutePath; System.IO.FileInfo oInfo = new System.IO.FileInfo(sPath); string sRet = oInfo.Directory.Name.ToString(); Response.Write(“<br><br>Directory name===” + sRet + “<br><br>”); Happy Coding Najam Sikander Awan
about 2 years ago - 1 comment
If you want to display the filename or page name of the current displaying page just use these two lines and it will show only the filename like default.aspx, najam.aspx or indexas.aspx no matter it these pages are located deep into your site structure. string pagename = System.IO.Path.GetFileName(Request.ServerVariables["SCRIPT_NAME"]); Response.Write(pagename); Enjoy coding Najam Sikander Awan