Internet Information Services is used to make your computer a web server. If we want to have a web server for developing dynamic website or want to publish website on our own server then we install the IIS.Internet Information Server (IIS) is a World Wide Web server, a Gopher server and an FTP server all rolledinto one. IIS means that you can publish...
Tuesday, August 31, 2010
Difference Between .net framework 2.0,3.0 and 3.5
NET framework 2.0:It brings a lot of evolution in class of the framework and refactor control including the support ofGenericsAnonymous methodsPartial classNullable typeThe new API gives a fine grain control on the behavior of the runtime with regards to multithreading, memory allocation, assembly loading and moreFull 64-bit support for both the x64...
Sunday, August 29, 2010
String Manupulation
i have a string like "a,b,c. upto n values".. Show this string like a, b, CSolstring str = "a,b,c";string[] arr = str.Split(',');foreach (string s in arr){Response.Write(s + ","...
Saturday, August 28, 2010
GridView Edit:on clicking edit a new page should be open where user can update data
GridView Edit:on clicking edit a new page should be open where user can update data
On clicking edit in GridView a new page should be open where user can update data. In this article i am explaining how to update record using GridView.When User Click edit button in GridView new page will be open where user can update record.in second page i have...
Friday, August 27, 2010
Send mail using asp.net c# code
Send mail using asp.net c# codeThis code describe how to send mail where mail id is stored in database and mail sender detail From,To,are stored in web.config file.Mail body can be customized according to requirement as described in code. public void MailSend() { try { string mailToAdd = String.Empty; MailMessage...
Wednesday, August 25, 2010
Resize image in ASP.NET
In this example i am going to describe how to resize image in ASP.NET before/and upload to ms sql database using C# and Vb.NET.For this i am using FileUpload control to upload the image in datbase after resizing.I am also displaying the Image in Gridviw after uploading to database. public partial class _Default : System.Web.UI.Page { protected...
Tuesday, August 24, 2010
ViewState And Session example
Hi,View state is used for store data at page level,you cant access View state data to another page.Session state is used for store data and you can access anywhere in your website.Session state is state specific information per client basis.Example is given below.View State: protected void btnSubmit_Click(object sender, EventArgs e) { ViewState["DataScorceName"]...
How to create connection string dynamically
Here i am using viewstate to create connection string at run time. protected void btnSubmit_Click(object sender, EventArgs e) { ViewState["DataScorceName"] = datasource; ViewState["Customer"] = txtCustomer.Text; } public void MyFunction() { string sqlConnectionString = "Persist Security Info=True;User ID=sa;Password=Sa;Initial...
How to reverse a string
char [] myArray = txtName.Text.ToCharArray(); Array.Reverse( myArray ); string strReversed = new string( myArray ); lblName.Text = strReversed;...
how to use Sql server Function
Sql server Function With Argumentshere it is simple example how to use function n sql server.1.Create function2.use this function where required.CREATE FUNCTION AddTwoNumber(@Num1 Decimal(6,2), @Num2 Decimal(6,2))RETURNS Decimal(6,2)BEGIN DECLARE @Result Decimal(6,2) SET @Result = @Num1 + @Num2 RETURN @ResultEND;GOPRINT MyDbName.dbo.AddTwoNumber(100,...
Sp for Creating db
Stored procedure for creating database.When you want to create database at run time using c# .net here is stored procedure execute this and pass database name as parameter.Create proc [dbo].[usp_Database](@dbName varchar(50))asIF NOT EXISTS (SELECT 'True' FROM INFORMATION_SCHEMA.SCHEMATA WHERE CATALOG_NAME = @dbName) -- DROP DATABASE ' + @dbName...
SetFocus to TextBox in GridView control
How to set focus in a GridView Set Focus to TextBox in GridView when click on Edit Some time we have requirement to set focus in gridview,so here i am describing to how to this.Drag and drop a gridview and bind it according to below code. protected void GridViewBind() { try { Ds = obBLLclass.GetData(); if (Ds.Tables[0].Rows.Count...
How to insert excel file into sql database in ASP.NET
Import EXCEL sheet data to SQL Database table in ASP.NETHere I will explain how to read excel file data and insert into in sql server database. protected void btnupload_Click(object sender, EventArgs e) { String excelConnectionString1; String fname = sendupload.PostedFile.FileName; if (sendupload.PostedFile.FileName.EndsWith(".xls"))...
Open Popup Wnidow With QueryString asp.net C#
How to open pop window using asp.net c#.Here code descibes how to open popup window with passing a query string in popup page. string popup = "<script language='javascript'>" + "window.open('poppage.aspx?data=" + HttpUtility.UrlEncode(qs.ToString()) + "','CustomPopUp', " + "'fullscreen=no,height=330,width=350,top=250,left=250,scrollbars=yes,...
Nested GridView in asp.net using C#
Nested GridView in asp.net using C#
Gridview within another gridview
This exmaple show how we can nest gridview.GridView inside other gridview for disply related data from database.Gridview can be nested in other Gridview control to display the related data of any item retrieved from database using C# code.
Steps:
1. Drag & drop a...
JavaScript for textbox should be numeric
JavaScript for textbox should be numericThis example show validate a textbox value is numeric.When you enter a non nemeric value in textbox popup message will display.<asp:TextBox ID="txtMinExperience" onKeyUp="benumeric();" runat="server" MaxLength="50" TabIndex="4" Width="50px">0</asp:TextBox><script language="javascript" type="text/javascript">function...
JavaScript validation for dropdownlist
JavaScript validation for dropdownlist
This example show how dropdownlist should be selected using javascript.
function validate()
{
var ddlCountry = document.getElementById('<%=ddlParameter.ClientID%>');
if(ddlCountry.value==0)
{
alert("Not Selected..!");
ddlParameter.focus();
return false;
}
return true;...
JavaScript form Validation in asp.net
JavaScript form Validation in asp.net
This simple code show how to do simple client side validation using javascript
Create a form with following:
1. Emp Name : <asp:TextBox ID="txtEmpName" />
2. Email : <asp:TextBox ID="txtEmailAdd" />
3. URL : <asp:TextBox ID="txturl" />
4. Zip : <asp:TextBox ID="txtZip"...
HyperLinkink in Gridview
Hyperlink column in Gridview Here i am describing very simple code for how to use Hyperlink column in Gridview <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" Height="1px" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound" Width="700px"> <Columns>...
How To Use Ajax
Hi....you can start with vs2008..1.just download ajaxcontrolkit.dll 2.copy this dll in your bin folder.3.add reference by right click on your website brouwse and add ajaxcontrolkit.dll4.add a new tab in your tolbox right click on toolbox add new tab and load aajax controll from bin folder.5.now can find all ajax control in your tolbox ready for u...
GridView ScrollBar
How to make scrollable gridview.<div style="overflow-y: scroll; height: 200px"> <asp:GridView ID="GridView1" runat="server" Font-Size="12px" BackColor="#FFFFFF" GridLines="Both" CellPadding="4" Width="560"> <HeaderStyle BackColor="#EDEDED" Height="26px" /> </asp:GridView></div>Thanks & RegardsSant...
Add new row using GridView footer column
Adding new record in database from Gridview footer rowAbstract: Here we will discuss about to add new recored in database using Gridview footer column.Just drag and drop a gridview in your page and follow the below code.This code in three tier applicationso i am writing here only front end code. <asp:GridView ID="gvStudentDetail" runat="server"...
Monday, August 23, 2010
AJAX Accordian Example
<ajaxToolkit:Accordion ID="acdContactInfo" runat="server" SelectedIndex="0" FadeTransitions="true" TransitionDuration="300" HeaderCssClass="accordHeader" ContentCssClass="accordionContent" HeaderSelectedCssClass="accordHeaderSelected"> <Panes> <ajaxToolkit:AccordionPane ID="empfirstAdd" runat="server" Width="100%"> <Header>>...
Simple GridView Bind code
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"AutoGenerateColumns="False"OnPageIndexChanging="GridView1_PageIndexChanging"OnRowDataBound="GridView1_RowDataBound"PageSize="10" Width="733px"TabIndex="2";><Columns;> <asp:BoundField HeaderText="Sr. No";> <ItemStyle HorizontalAlign="Center" /;> </asp:BoundField;>...
GridView find control
protected void ddlQty_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow gr = (GridViewRow)((DataControlFieldCell)((DropDownList)sender).Parent).Parent; DropDownList ddlQty = (DropDownList)gr.FindControl("ddlQty"); if (ddlQty != null) { Label lblPrice...
Enable textbox in gridview on click checkbox
JavaScriptfunction callonclick(obj) { var sdt = obj.split("_"); var chkDeny=document.getElementById('ctl00_ContentPlaceHolder1_gv_'+sdt[3]+'_chkDeny'); var txtReason=document.getElementById('ctl00_ContentPlaceHolder1_gv_'+sdt[3]+'_txtReason'); if(chkDeny.checked) { txtReason.value=""; txtReason.disabled...
Deployment
1.Right click your website and click on Publish website.All compiles files are ready for deployment.2.Create a backup for database whichever you are using and restore it on production server.3.Go to server using ftp or filezila copy all compiles file on server.4.Open Webconfig and change the connection string according to your Database name and server.5.Create...
DataReader
A DataReader is a read-only forward-only way of reading data. It is quiet fast when compared to fetching data using a DataSet.Some important point:Read-only accessSupports a single table based on a single SQL query of one databaseConnected modeBind to a single controlForward-only scanning of dataFaster access to dataLightweight object with very little...
CSS For FieldSet control in asp.net
.fldset{ border: solid 1px #A8A8A8; background-color:#FCFCFC; display:inline; }.fldsetlegend{ font-size:11px; background-color: #56458C; color:#FCFCFC; font-weight:bold; font-variant:small-caps; padding: 0px 8px 2px 8px; margin: 2px 0px 10px 0px; } Thanks & RegardsSant...
CSS For AJAX Tab
.AJAXTab_Theme .tab_header { font-family:"Helvetica Neue", Arial, Sans-Serif; background:url(/PNG/Light-menu.png) repeat-x bottom; height:20PX ; font-size:12px; display:block; } .AJAXTab_Theme .tab_header .tab_outer { background:url(/Images/Tab/tab.png) no-repeat left top; border-color:#222; color:#222; ...
Create pdf from datatable
How to create pdf from datatable in asp.net c#.Solution is given below.public void ExportToPdf(DataTable myDataTable) { Document pdfDoc = new Document(PageSize.A4, 10, 10, 10, 10); try { PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Response.OutputStream); pdfDoc.Open(); ...
Create autogenerate serial number in Gridview
Auto Generate Serial Number In GridviewThe Given code auto generate serial number with page index changing.Generate Dynamic Serial Number in GridView is coommon task for many programmerHere i explain it in very simple way1: Drag GridView in you asp.net web page.2: Go to Gridview properties and Click on Columns than add Template Column.3:Code is given...
How to check Record Exist in table before insert
Here i am explain you check if record is not exist in database then insert otherwise update the table.CREATE PROCEDURE [dbo].[uspInst_Addupdate]( @InstId int, @Inst varchar(50),) ASBEGIN IF @InstId=0 BEGIN IF NOT EXISTS(SELECT * FROM InstMaster WHERE Inst= @Inst) INSERT INTO InstMaster(Inst) VALUES(@Inst) END ELSE BEGIN UPDATE InstMaster...
Change GridView RowColor
How to change gridview row color and use css class.Below code describe how to call css class at runtime for change the gridview row color.protected void gv_RowDataBound(object sender, GridViewRowEventArgs e){ if (e.Row.RowType == DataControlRowType.DataRow) { string checkstatus= Convert.ToString(DataBinder.Eval(e.Row.DataItem,"checkstatus"));...
How to change DateFormat
string[] str = txtIssuedOnVisa.Text.Trim().Split('/');string strIssuedOn = str[1].ToString() + "/" + str[0].ToString() + "/" + str[2].ToString();Thanks & RegardsSant...
Cascading Dropdownlist
ASPX Page<asp:DropDownList ID="ddlCountry" runat="server" AutoPostBack="True" DataTextField="CountryName" DataValueField="CountryId" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged";> <asp:ListItem Value="0" Text="<Select Country;>";></asp:ListItem;></asp:DropDownList;><asp:DropDownList ID="ddlState" runat="server"...
Authentication And Authorization
Authentication And AuthorizationAuthentication is the process of identification and validation of a user's credentials. After the identity is authenticated,a process called authorization determines whether that identity has access to a particular resource.ASP.NET provides three ways to authenticate a user:Forms authenticationWindows authenticationPassport...
Saturday, August 14, 2010
Javascript date validation
function DateValid(){ var sDate = document.getElementById('').value; var eDate = document.getElementById('').value; var endDate = new Date(eDate ); var startDate= new Date(sDate ); if(sDate != '' && eDate != '' && startDate > endDate ) { alert("Start date should be greater than End Date."); return false; } if(sDate...
Monday, August 9, 2010
When Gridview has no record display empty grid at runtime
When GridView(Add New Record) has no record display empty Grid at runtime.Some time when we adding new row in gridview footer column and there is no record in database,so what we can do?So we can disply message no record found and add new button show for adding new record.Here is solution display runtime empty gridview. private void ShowNoResultFound(DataSet...
Wednesday, August 4, 2010
Session object in asp.net
Session object:Session object is used to store state specific information per client basis. It is specific to particular user.Session data persists for the duration of user session you can store session's data on web server in different ways.Session state can be configured using the section in the application's web.config file.Session state in ASP.NET...
Tuesday, August 3, 2010
AJAX
AJAX tab controlHere i describing a simple example how to use tab control in asp.net.aspx code< ajaxToolkit:TabPanel ID="tabFirst" runat="server" Width="111px" > < HeaderTemplate> First Tab Header name < /HeaderTemplate> < ContentTemplate> < br /> < asp:GridView ID="gvEmpDetail" runat="server" DataKeyNames="EmpId"...
Monday, August 2, 2010
Gridview custom sorting using asp.net c#
public partial class _Default : System.Web.UI.Page{ private const string ASCENDING = " ASC"; private const string DESCENDING = " DESC"; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SortGridView(sortExpression, ""); } } public SortDirection GridViewSortDirection {...