Use this space to put some text. Update this text in HTML

468x60 banner ad

Advertise with Us

Powered by Blogger.

Friday, 6 May 2016

Ajax Updapanel Control with Triggers


When you are using simple asp.net application and you have to click on button, the hole page is postback to the server.

If we want to avoid this full postback of page and round trip to server we need to use ajax updatepanel control for partial page postback.

Ajax updatepanel is used to avoid full postback of the page, avoid refresh of the whole page content with postback. By using Ajax updatepanel we can refresh only required part of page instead of refreshing whole page.
UpdateMode Property
When an UpdatePanel control is not inside another UpdatePanel control, the panel is updated according to the settings of the UpdateMode and ChildAsTriggers properties, together with the collection of triggers.
By default updatepanel contains UpdateMode="Always" if we want to set it conditionally we need to change this property UpdateMode="Conditional"

If the UpdateMode property is set to Always, the UpdatePanel control's content is updated on every postback that originates from anywhere on the page.

ChildrenAsTriggers Property

If the UpdateMode property is set to Conditional

1.The postback is caused by a control that is defined as a trigger by using the Triggers property of the UpdatePanel control. the control explicitly triggers an update of the panel content.

2. The ChildAsTriggers property is set to true and a child control of the UpdatePanel control causes a postback.

3.A child control of a nested UpdatePanel control does not cause an update to the outer UpdatePanel control unless it is explicitly defined as a trigger
4.When an UpdatePanel control is inside another UpdatePanel control, the child panel is automatically updated when the parent panel is updated.
ContentTemplate is used to hold the content of the page means suppose we designed page with some controls we will place controls inside of the ContentTemplate

 


Example

.aspx Page

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdPnlTest" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <table width="30%" align="center" style="border: 1px solid black;" cellpadding="5"
                cellspacing="0" border="0">
                <tr>
                    <td colspan="4" class="clsError">
                        <br />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" style="color: Green; font-family: Times New Roman; font-size: 14px;
                        font-weight: bold;">
                        <asp:Label ID="lblUpdatePanelResult" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="clsError">
                        <br />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" style="color: Blue;">
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="clsError">
                        <asp:Button ID="btnUpdatePanel" CssClass="CLSBUTTON" runat="server" Text="Update Panel"
                            OnClick="btnUpdatePanel_Click" />
                        &nbsp;
                    </td>
                </tr>
            </table>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnUpdatePanel" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <br />
    <br />
    <table width="30%" align="center" style="border: 1px solid black;" cellpadding="5"
        cellspacing="0" border="0">
        <tr>
            <td colspan="4" class="clsError">
                <br />
            </td>
        </tr>
        <tr>
            <td colspan="4" style="color: Green;">
            </td>
        </tr>
        <tr>
            <td colspan="4" class="clsError">
                <br />
            </td>
        </tr>
        <tr>
            <td colspan="4" style="color: Blue; font-family: Times New Roman; font-size: 14px;
                font-weight: bold;">
                <asp:Label ID="lblWithoutUpdatePanelResult" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="4" class="clsError">
                <br />
            </td>
        </tr>
        <tr>
            <td colspan="4" class="clsError">
                &nbsp;
                <asp:Button ID="btnWithoutUpdatePanel" runat="server" CausesValidation="false" CssClass="CLSBUTTON"
                    Text="Without Update Panel" OnClick="btnWithoutUpdatePanel_Click" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>


.aspx.cs Page

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_UpdatePanel : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnUpdatePanel_Click(object sender, EventArgs e)
    {
        lblUpdatePanelResult.Text = "Using Update Panel Refreshed at " +DateTime.Now.ToString();
    }
    protected void btnWithoutUpdatePanel_Click(object sender, EventArgs e)
    {
        lblWithoutUpdatePanelResult.Text = "Without Using Update Panel Refreshed at " + DateTime.Now.ToString();
    }
}

Result:


Thursday, 5 May 2016

What is metadata in Net

What is metadata in Asp.Net?
1. Metadata is stored in binary format. Therefore, metadata of an assembly is sharable among applications that execute on various platforms. It can also be exported to other applications to give information about the services and various features of an application.
2. An assembly metadata describes every data type and member defined in the code.
3. It stores the description of an assembly, such as name, version, culture, public key of an assembly along with the types exported, other assemblies dependent on this assembly, and security permissions needed to run the application.


Is versioning applicable to private assemblies in Asp.Net?

No, versioning is not applicable to private assemblies as these assemblies reside in their individual folders. Versioning can be applied to GAC only.

What is Assembly Manifest in Asp.Net?
 
Assemblies maintain all their information in a special unit called the manifest. Every assembly has a manifest.

The followings are the contents of an Assembly Manifest:
  • Assembly name - Represents a text string that specifies the assembly's name.
  • Version number - Represents a major and minor version number, as well as a revision and build number. The CL.R makes use of these numbers to enforce version policy.
  • Culture - Represents information of the culture or language, which the assembly supports. An assembly is a container of only resources containing culture- or language-specific information.
  • Strong name information - Represents the public key from the publisher, if a strong name is assigned to an assembly.
  • List of all files in the assembly - Represents a hash of each file contained in the assembly and a file name.
  • Type reference information - Represents the information used at the runtime to map a type reference to the file that contains its declaration and implementation.
  • Information on referenced assemblies - Represents a list of other assemblies that are statically referenced by the assembly. Each reference includes the names of dependent assemblies, assembly metadata (version, culture, operating system, and so on), and public key, if the assembly is strong named.
Name the MSIL Disassembler utility that parses any .NET Framework assembly and shows the information in human readable format

The Ildasm.exe utility.

What is the significance of the Strong Name tool in Asp.Net?

The Strong Name utility (sn.exe) helps in creating unique public-private key pair files that are called strong name files

Where is the information regarding the version of the assembly stored in Asp.Net?

Information for the version of assembly is stored inside the assembly manifest.

Can one DLL file contain the compiled code of more than one .NET language?
 
No, a DLL file can contain the compiled code of only one programming language.

What is the maximum number of classes that can be contained in a DLL file?

There is no limit to the maximum number of classes that can be contained in a DLL file.

What is a satellite assembly in Asp.Net?

Satellite assemblies are assemblies that are used to deploy language and culture specific resources for an application. In an application, a separate product ID is assigned to each language and a satellite assembly is installed in a language specific sub-directory.

What is the Global Assembly cache(GAC)? What problem does it solve?

1. GAC stands for Global Assembly Cache. It is a machine-wide code repository or cache where the registered assemblies must have a strong name and version number.
2. GAC is nothing but a special disk folder where all the shared assemblies will be kept.
3. the default location for the global assembly cache is %windir%\Microsoft.NET\assembly. In earlier versions of the .NET Framework, the default location is %windir%\assembly.

GAC helps in the problem of DLL hell. Dll hell is produced when there is Version conflict. Say you have installed Adobe Premier 5 and also Adobe Photoshop 7. Or you want both Photoshop 7 and Photoshop CS to run side by side in the same machine. In case of COM, once a DLL is registered, if you want to register a new version of it, you need to unregister the previous dll and then register the new one. This makes cumbersome and hence DLL hell arises where the older version ceases to execute when new version is installed.

The uses of GAC are as follows:

1) You can store multiple versions of the same assembly on a machine and execute them side by side.
2) Store the same assemblies in multiple locations on a machine uses additionally unneeded storage. Keeping them in one location reduces this cost.




what is metadata in assembly in net, what is manifest in c#, metadata c sharp, metadata in c# example, c# metadata file could not be found, c# metadata class,assembly metadata and manifest in net