Skip to main content

Posts

Showing posts from April, 2011

storeprocedure

ALTER PROCEDURE USP_IDFU_Customers (@CustomerId int = null, @Name varchar(30) = null, @PhoneNo varchar(50)=null, @EmailId Varchar(30)=null, @Address varchar(50)=null, @City varchar(30)=null, @state varchar(30)=null, @Pincode varchar(30)=null, @IsActive bit = null, @Type char(1) ) as if(@Type = 'I') begin insert into Customer(Name,PhoneNo,EmailId,Address,City,State,PinCode,IsActive)values(@Name,@PhoneNo,@EmailId,@Address,@City,@State,@PinCode,@IsActive) end if(@Type = 'D') begin Delete from Customer where CustomerId=@CustomerId end if(@Type = 'F') begin select * from Customer end if(@Type = 'U') begin update Customer set Name=@Name,PhoneNo=@PhoneNo,EmailId=@EmailId,Address=@Address,City=@City,State=@State,PinCode=@PinCode,IsActive=@IsActive where CustomerId=@CustomerId end
"People will remember you after you are gone not for your money or your power, but because of what you have left behind."

val

RequiredFieldValidator This is one of the important controls used in majority of web applications. If a user fails to enter the required information on the form then the message given on this validation control will appear thereby forcing the user to fill up the required information. The code given below will illustrate this concept in detail Name: Age:    I have placed two textboxes and the required number of RequiredFieldValidator controls. The message given along with the ErrorMessage property will be displayed if the user doesn't enters any data on to the relevant text boxes (See the Figure given below) Figure 1

prefix

Button btn RadioButton rad CheckBox chk RadioButtonList radl CheckBoxList chkl TextBox txt DataGrid dgrd RequiredFieldValidator valr DataList dlst CompareValidator valc DrpDownList drop RangeValidator valg Image img RegularExpressionValidator vale ImageButton ibtn CustomValidator valx Label lbl ValidationSummary vals LinkButton lbtn Table tbl ListBox lst Calendar cal

DBLAYER

using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; namespace db2.API { public class DBLayer { SqlCommand ObjCmd; SqlDataAdapter ObjDa; DataSet ObjDs; SqlConnection Con = SqlConnection(ConfigurationManager.AppSettings["SqlCon"]); public int ExecuteNonQuery(string ObjStr, SqlParameter[] Parameter) { Con.Open(); ObjCmd = new SqlCommand(); ObjCmd.CommandType = CommandType.StoredProcedure; ObjCmd.CommandText = ObjStr; ObjCmd.Parameters.AddRange(Parameter); return ObjCmd.ExecuteNonQuery(); Con.Close(); } public int ExecuteScalar(string ObjStr, SqlParameter[] Parameter)

FillingDDl

private void FillDropDown() { string strConn = ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(strConn); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select CountryID, Country from Country"; DataSet objDs = new DataSet(); SqlDataAdapter dAdapter = new SqlDataAdapter(); dAdapter.SelectCommand = cmd; con.Open(); dAdapter.Fill(objDs); con.Close(); if (objDs.Tables[0].Rows.Count > 0) { ddlCountry.DataSource = objDs.Tables[0]; ddlCountry.DataTextField = "Country"; ddlCountry.DataValueField = "CountryID"; ddlCountry.DataBind(); ddlCountry.Items.Insert(0, "--Select--"); } else { lblMsg.Text = "No Countries found"; } }

Same chart showing in two different ChartAreas

.aspx code: ImageStorageMode="UseImageLocation" Width="600px" ImageLocation="~/images/TempCharts"> IsStartedFromZero="False"> ImageStorageMode="UseImageLocation" Width="600px" ImageLocation="~/images/TempCharts" DataSourceID="sdsPieProductsIn"> .aspx.cs code: public void DrawPieChart() { DataView dv = (DataView)sdsPieProductsIn.Select(DataSourceSelectArguments.Empty); ArrayList xValues = new ArrayList(); ArrayList yValues = new ArrayList(); PieChartProductsIn.ChartAreas["PieChartArea"].Area3DStyle.Enable3D = true; PieChartProductsIn.Titles["PieTitle"].Text = "Fordeling"; for (int i = 0; i < dv.Count; i++) { xValues.Add(dv[i][6].ToString()); yValues.Add(dv[i][11].ToString());

Line graph in asp.net

How to create line graph in ASP.NET?? I have downloaded MS chart controls & done like this : Url="" XValue="5" YValues="10" /> But the lines are not getting displayed.Can any1 help m?? Click Here Responses Author: srinivas Member Level: Gold Member Rank: 0 Date: 26/Aug/2009 Rating: 2 out of 52 out of 5 Points: 2 Try This: <%@ Page Language="C#" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.Drawing" %> <%@ Import Namespace="System.Drawing.Drawing2D" %> <%@ Import Namespace="System.Drawing.Imaging" %> Regards, sri.

Drawing Line Charts In asp.net

LineChart.cs import the following namespaces using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Collections; public class LineChart { public Bitmap Bitmapb; public string strTitle = "Default Title"; public ArrayList ArrayListchartValues = new ArrayList(); public float ftXorigin = 0, ftYorigin = 0; public float ftScaleX, ftScaleY; public float ftXdivs = 2, ftYdivs = 2; private int intWidth, intHeight; private Graphics Graphicsg; private Page Pagep; struct datapoint { public float ftx; public float fty; public bool bolvalid; } //initialize public LineChart(int intmyWidth, int intmyHeight, Page myPage) { intWidth = intmyWidth; intHeight = intmyHeight; ftScaleX = intmyWidth; ftScaleY = intmyHeight; Bitmapb = new Bitmap(intmyWidth, intmyHeight); Graphicsg = Graphics.FromImage(Bitmapb); Pagep = myPage; } pu