Blog Home  Home Feed your aggregator (RSS 2.0)  
Software Code Help - aspnet
Blog
 
# Sunday, October 04, 2009

First Download IE Web Control from this location.

http://www.asp.net/downloads/archived/ie-web-controls/IEWebControls.exe
 
To build the IE Web Controls:

1.  Make sure you have installed the .NET Framework SDK v1.0 or v1.1
2.  Run Build.bat, which will create a build folder in this directory. 
    The build folder contains Microsoft.Web.UI.WebControls.dll and a
    Runtime directory of supporting files.

To run the IE Web Controls:

1.  Copy the contents of the Runtime directory to the webctrl_client\1_0
    directory under your top-level site directory.  For example, if your
    site root is c:\Inetpub\wwwroot, type this at the command prompt:

    IE Installable Path>xcopy /s /i .\build\Runtime c:\Inetpub\wwwroot\webctrl_client\1_0 /y

    This will create the following directory structure under the site:

      /webctrl_client/1_0
        MultiPage.htc
        TabStrip.htc
        toolbar.htc
        treeview.htc
        webservice.htc
        webserviced.htc
        [images]
        [treeimages]

2.  Create a new web application in IIS and copy the contents of the
    samples directory to this application directory.  For example:

    xcopy /s /i .\samples c:\Inetpub\wwwroot\sampleapp /y

3.  Create a /bin subdirectory for the application and copy the file
    Microsoft.Web.UI.WebControls.dll to this directory.

    The contents of the application will be as follows:

      /sampleapp
        multipage.aspx
        state_city.xml
        tabstrip.aspx
        toolbar.aspx
        treeview.aspx
        treeview_bound.aspx
        /bin
          Microsoft.Web.UI.WebControls.dll

4.  Request the sample pages from your Internet Explorer web browser, for
    example: http://localhost/sampleapp/multipage.aspx
   
For additional documentation and samples visit:
http://msdn.microsoft.com/library/default.asp?url=/workshop/webcontrols/webcontrols_entry.asp

Sunday, October 04, 2009 7:36:15 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 
# Tuesday, July 07, 2009

Caching is the technique of storing an in-memory copy of some information that’s expensive to create. For example, you could cache the results of a complex query so that subsequent requests don’t need to access the database at all. Instead, they can grab the appropriate object directly from server memory—a much faster proposition. The real beauty of caching is that unlike many other performance-enhancing techniques, caching bolsters both performance and scalability.


Output caching: This is the simplest type of caching. It stores a copy of the final rendered HTML page that is sent to the client. The next client that submits a request for this page doesn’t actually run the page. Instead, the final HTML output is sent automatically. The time that would have been required to run the page and its code is completely reclaimed.

Data caching: This type of caching is carried out manually in your code. To use data caching, you store important pieces of information that are time-consuming to reconstruct (such as a DataSet retrieved from a database) in the cache. Other pages can check for the existence of this information and use it, thereby bypassing the steps ordinarily required to retrieve it.

Fragment caching: This is a specialized type of output caching—instead of caching the HTML for the whole page, it allows you to cache the HTML for a portion of it. Fragment caching works by storing the rendered HTML output of a user control on a page. The next time the page is executed, the same page events fire (and so your page code will still run), but the code for the appropriate user control isn’t executed.

Data source caching: This is the caching that’s built into the data source controls, including the SqlDataSource, ObjectDataSource, and XmlDataSource. Technically, data source caching uses data caching. The difference is that you don’t need to handle the process explicitly.
Instead, you simply configure the appropriate properties, and the data source control manages the caching storage and retrieval.

Tuesday, July 07, 2009 7:08:32 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 
# Monday, June 29, 2009
In ASP.NET 2.0, managing controls has become easier. Instead of declaring them on every page, you can declare them only once in your web.config file and use them in your entire project.
<configuration>
    <system.web>       
      <pages>
            <controls>
                  <add tagPrefix="portal" tagName="Top"src="~/Controls/Top.ascx" />
            </controls >
      </pages >  
    </system.web>
</configuration>
Once you have registered this control in your web.config, you can use this control on any page without explicitly adding a register directive on the page.
<body>
    <form id="form1" runat="server">
    <div>
        <portal:Top ID="Top1" runat="server" />
    </div>
    </form>
</body>
 
Monday, June 29, 2009 10:03:00 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 
# Friday, June 26, 2009

One difference is that web forms start with the Page directive, a master page starts with a Master directive that specifies the same information, as shown here:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="SiteTemplate.master.cs" Inherits="SiteTemplate" %>

Another difference between master pages and ordinary web forms is that master pages can use the ContentPlaceHolder control, which isn’t allowed in ordinary pages. The ContentPlaceHolder is a portion of the page where the content page can insert content.

Friday, June 26, 2009 12:47:09 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 
# Wednesday, June 24, 2009

Every .aspx page starts with a Page directive. This Page directive specifies the language for the page,
and it also tells ASP.NET where to find the associated code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FileName.aspx.cs" Inherits="FileName"%>

Notice that Visual Studio uses a slightly unusual naming syntax for the source code file. It has
the full name of the corresponding web page, complete with the .aspx extension, followed by the .cs
extension at the end.

Wednesday, June 24, 2009 12:40:20 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 

LINQ and Ajax are the two new features introduced in ASP.NET 3.5

LINQ
-----
LINQ (Language Integrated Query) is a set of extensions for the C# and Visual Basic languages. It allows you to write C# or Visual Basic code that manipulates in-memory data in much the same way you query a database.

Technically, LINQ defines about 40 query operators, such as select, from, in, where, and orderby (in C#). These operators allow you to code your query. However, there are various types of data on which this query can be performed, and each type of data requires a separate flavor  of LINQ.

AJAX
-----
Ajax(Asynchronous JavaScript and XML)is programming shorthand for a client-side technique that allows your page to call the server and update its content without triggering a complete postback. Typically, an Ajax page uses client-side script code to fire an asynchronous request behind the scenes. The server receives this request, runs some code, and then returns the data your page needs (often as a block of XML markup). Finally, the client-side code receives the new data and uses it to perform another action, such as refreshing part of the page.

Green Bits and Red Bits
-------------------------
Oddly enough, ASP.NET 3.5 doesn’t include a full new version of ASP.NET. Instead, ASP.NET 3.5 is designed as a set of features that add on to .NET 2.0. The parts of .NET that haven’t changed in .NET 3.5 are often referred to as red bits, while the parts that have changed are called green bits. The red bits include the CLR, the ASP.NET engine, and all the class libraries from .NET 2.0. In
other words, if you build a new ASP.NET 3.5 application, it gets exactly the same runtime environment as an ASP.NET 2.0 application. Additionally, all the classes you used in .NET 2.0—including those for connecting to a database, reading and writing files, using web controls, and so on—remain the same in .NET 3.5. The red bits also include the features that were included in .NET 3.0, such as WCF. All the assemblies in .NET 3.5 retain their original version numbers. That means .NET 3.5 includes a mix of 2.0, 3.0, and 3.5 assemblies. If you’re curious when an assembly was released, you simply need to check the version number.

The ASP.NET 3.5 green bits consist of a small set of assemblies with new types. For ASP.NET developers, the important new assemblies include the following:

• System.Core.dll: Includes the core LINQ functionality
• System.Data.Linq.dll: Includes the implementation for LINQ to SQL
• System.Data.DataSetExtensions.dll:. Includes the implementation for LINQ to DataSet
• System.Xml.Linq.dll: Includes the implementation for LINQ to XML
• System.Web.Extensions.dll: Includes the implementation for ASP.NET AJAX and new web controls


Silverlight
-----------
Recently, there’s been a lot of excitement about Silverlight, a new Microsoft technology that allows a variety of browsers on a variety of operating systems to run true .NET code. Silverlight works through a browser plug-in, and provides a subset of the .NET Framework class library. This subset includes a slimmed-down version of WPF, the technology that developers use to craft next-generation Windows user interfaces.

Silverlight is all about client code—quite simply, it allows you to create richer pages than you could with HTML, DHTML, and JavaScript alone. In many ways, Silverlight duplicates the features and echoes the goals of Adobe Flash. By using Silverlight in a web page, you can draw sophisticated 2D graphics, animate a scene, and play video and other media files.

Wednesday, June 24, 2009 11:24:55 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 

Some of the differences between ASP.NET and ASP include the following:

• ASP.NET features a completely object-oriented programming model, which includes an event driven,
control-based architecture that encourages code encapsulation and code reuse.

• ASP.NET gives you the ability to code in any supported .NET language (including VisualBasic, C#, J#,
and many other languages that have third-party compilers).

• ASP.NET is dedicated to high performance. ASP.NET pages and components are compiled ondemand
instead of being interpreted every time they’re used. ASP.NET also includes a finetuned
data access
model and flexible data caching to further boost performance.

Wednesday, June 24, 2009 10:46:33 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 
# Monday, June 22, 2009
      Microsoft .net framework provide a facility for sending mail using System.Web.Mail(SMTP)
      First include this using System.Web.Mail in your code, For sending mail we are creating a function sendMail,
      it is used for sending email. For correctly running
      this code, please find register two dll "cdonts.dll" and "cdosys.dll".
      These two dll is microsoft dll used for sending mail.
 
      public void sendMail()
        { 

            try 

            {  

                //Provides properties and methods for sending messages using the Collaboration Data Objects for 
                  Windows 2000 (CDOSYS) message component.
                SmtpMail.SmtpServer= "SMTP Server IP Address";                 MailMessage msg = new MailMessage();                 // Specify the e-mail sender.                 msg.From = "rajshekhar@mail.com";//Self mail address // Set destinations for the e-mail message.                 msg.To = "Send Email Address";                 // Set destinations of Carbon Copy(CC) for the e-mail message.                 msg.Cc = "CC Email Address;                 // Set destinations of Blind carbon copies(BCC) for the e-mail message.                 msg.Bcc = "BCC Email Address";                 // Specify the message subject.                 msg.Subject = this.txtSubject.Text;                 // Specify the message content.                 msg.Body = "Content of Message Assign Here";                 msg.BodyFormat = MailFormat.Text;                 //The username for authenticating to an SMTP server using basic (clear-text) authentication.                 msg.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername",
                                 "itq@vmaildeliver.vsnl.com");
                //The password used to authenticate to an SMTP server using basic (clear-text) authentication.                 msg.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword","itq.1.123");                 /%                         Specifies the authentication mechanism to use when authentication is required to send messages
                to an SMTP service using a TCP/IP network socket.                                                          The Secound parameter in smtpauthenticateis CdoProtocolsAuthentication enumeration, It is
                used to specify the mechanism used when authenticating to a Simple Mail Transfer Protocol(SMTP)
                service over the network.                 It has three different type of value:                 Name            Value                Description                 ====            =====                ============                 cdoAnonymous     0                 Do not authenticate.                                  cdoBasic         1                 Use basic (clear-text) authentication. The configuration
                                                   sendusername/sendpassword or postusername/postpassword fields
                                                  are used to specify credentials.                                  cdoNTLM             2              Use NTLM authentication (Secure Password Authentication in
                                                   Microsoft® Outlook® Express).The current process security
                                                   context is used to authenticate with the service.                                  */                                             msg.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1);                 //Sending Message                             SmtpMail.Send(msg);                              }             catch (Exception ex)             {                 ErrorMessage("Send Mail Process was failed!!!");                              }             finally             {                                  SuccessMessage("Send Mail Process was successfull!!!");             }         }

You can use this above code for sending mail using SMTP in ASP.NET.

Monday, June 22, 2009 11:26:30 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   .Net | asp.net  | 
# Sunday, June 21, 2009
private void Page_Load(object sender, System.EventArgs e)
        {
            DataSet objds        = null;
            OleDbConnection conn = null;
            try
            {            
                if (File.Exists(Server.MapPath("UploadedFare/UploadedFare.xls").Trim()))
                {
                    gblConnSting = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath
                     ("UploadedFare/UploadedFare.xls").Trim() + ";Extended Properties=\"Excel 8.0;HDR=YES;\"";                     conn    = new OleDbConnection(gblConnSting);;                                                          conn.Open();                     objds = new DataSet();                     OleDbDataAdapter objAdp    = new OleDbDataAdapter("select * from [Sheet1$] where
                                                                     [Airline] <> '' OR [Airline] <> null"
,conn);                     objAdp.AcceptChangesDuringFill = false;                     objAdp.Fill(objds);                             dgExcelData.DataSource    = objds.Tables[0].DefaultView;                     dgExcelData.DataBind();                 }                 else                     Response.Write("<B>No Fare Is Uploaded !</B>");             }             catch(Exception ex)             {                 new clsErrorLogging(ex);             }                     finally             {                 dgExcelData.Dispose();                 objds.Dispose();                 conn.Dispose();             }         }
 
Datagrid

       <asp:datagrid id="dgExcelData" runat="server" HeaderStyle-Wrap="False" BorderColor="LightGray"
        BorderWidth="1px">
        <ItemStyle Font-Size="X-Small" Wrap="False"></ItemStyle>
        <HeaderStyle Font-Size="Smaller" Font-Names="Verdana" Font-Bold="True" Wrap="False" HorizontalAlign="Center"
         ForeColor="Black" VerticalAlign="Middle" CssClass="tableheadergrey2" BackColor="Gainsboro" ></HeaderStyle>
       </asp:datagrid>
Sunday, June 21, 2009 11:37:58 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net | C#  | 

we can attach javascript in code behind using this style

 

private void Page_Load(object sender, System.EventArgs e)

{

System.Text.StringBuilder StrValidation = new System.Text.StringBuilder();

//Appending javascript in this string builder

StrValidation.AppendFormat("{0}",@"<script language='javascript'>

function validateForm()

{

if (isBlank(document.baseForm.txtEmail.value)) {

alert('Email ID can not be blank1 !');

document.baseForm.txtEmail.focus();

return false;

}

if (isBlank(document.baseForm.txtSubject.value)) {

alert('Subject can not be blank !');

document.baseForm.txtSubject.focus();

return false;

}

if (isBlank(document.baseForm.txtMessage.value)) {

alert('Please Enter Message in Message Box !');

document.baseForm.txtMessage.focus();

return false;

}

return true;

} </script>");

Page.RegisterClientScriptBlock("AddValidation",StrValidation.ToString());

this.ibtnSubmit.Attributes.Add("onClick", "return validateForm();");

Sunday, June 21, 2009 11:21:26 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 

private void Page_Load(object sender, System.EventArgs e)

{

      base.OuterTable.HorizontalAlign = HorizontalAlign.Center;

      base.ContentBar.VerticalAlign = VerticalAlign.Top;

}

Sunday, June 21, 2009 11:18:50 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 
Copyright © 2010 SoftwareCodeHelp. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: