Feeds:
Posts
Comments

    public void ExportToExcel(string strFileName, DataGrid dataGrid)
    {
            Response.ClearContent();
            string attachment = String.Concat(“attachment; filename=”, strFileName ,”.xls”);
            Response.AddHeader(“content-disposition”, attachment);
            Response.ContentType = “application/ms-excel”;
            System.IO.StringWriter sw = new System.IO.StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            dataGrid.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();
       }

When creating a server control from scratch you must implement the IPostBackEventHandler interface if you want the control to handle postback events. If you’re extending an existing control and the control already implements this interface, then you simply need to override the IPostBackEventHandler methods to add your own postback events.

Continue Reading »

Many a times it’s required to disable the button at client side before firing the server side event. One best example is while processing credit card payments, the button has to be disabled until the card details are processed which is a time consuming job. This may sometimes seem to be unresponsive, so if the user clicks the button once again the risk is that payment may get processed twice.

Continue Reading »

ASP.NET and AJAX Basic Training ppt.

PPT Contents

  • What is ASP.NET? 
  • ASP.NET Versions
  • Difference Between ASP and ASP.NET
  • ASP.NET Architecture Overview
  • ASP.NET IIS life cycle Overview
  • ASP.NET Page life cycle Overview
  • ASP.NET State Management Overview
  • ASP.NET Security
  • JavaScript, CSS file
  • Walkthrough Creating Webpage in ASP.NET
  • Ajax- Introduction

Microsoft® Visual C#® Default Keybindings

Below generic code used to clear the form fields in asp or asp.net webpage. This code is written in JavaScript to avoid postback to server. 

Continue Reading »

FileUpload Class: The fileupload class display a textbox and browse button that enable user to select an file on client side and upload it to the web server. Either user can type full file path in textbox or can select file by clicking the browse button and locating file it in the choose file dialog box.

The Fileupload control does not automatically save a file to server after user have selects files to upload. you must explicit provide a control to allow user to upload specified file.For example , you can provide button that the user click to upload the file.

Continue Reading »

In .NET application if developer wants to access SQL database then have to use using System.Data.SqlClient namespace, for oracle using Sytem.Data.OracleClient namespace, for MS-Access using System.Data.OleDb namespace.Suppose developer wants to access database based on user selected database(SQL or Orcale or MS-Access) in GUI application,then developer have use System.Data.Common namespace to access seleted database.If it’s single database developer can use that database namespace. If it’s multiple database then use have to use System.Data.Common namespace.

 DownLoadSampleCode: System.Data.Common               

    

 
 

It very difficult to add or insert or delete a string in array,but using
System.Collections.Specialized.StringCollection();we can manipulate  

string array rapidly.   

Sample Code:
 

private String[] strArray = new String[] {}; 

 ///Write this Code in  Constructor

strCollection = new System.Collections.Specialized.StringCollection();

strCollection.AddRange(strArray);

//Add String 

strCollection.Add(richTextBox1.Text.Trim()); 

richTextBox1.Text = string.Empty;  

// Display StringArray 

StringBuildersb = new StringBuilder(); 

for (inti = 0; i < strCollection.Count; i++) 

sb.Append(strCollection[i]); 

sb.Append(Environment.NewLine);  

richTextBox2.Text = sb.ToString(); 

// Get the String Array 

strArray = new String[strCollection.Count];  

strCollection.CopyTo(strArray, 0); 

return strArray; 

// Remove String  

strCollection.Remove(“Value”) ; 

strCollection.RemoveAt(index); 

// Get the Index of Array  

strCollection.IndexOf(“Value”) 

strCollection.Insert(index,“value”) 

Before seeing  Xml Validation Reader let us see XSD (Xml Schema Definition)

What is XSD?

XSD provides the syntax and defines a way in which element and attributes can represent in Xml Documents.

Continue Reading »

Older Posts »

Follow

Get every new post delivered to your Inbox.