google

Newest Post

Aggregation in Rad Grid Columns

| Thursday, January 30, 2014
Read more »
This article explains how to display total values of Rad Grid columns in the footer row using aggregate function like "Sum".

 FooterAggregateFormatString="{0:g}"
displays only number(100) in the footer instead of "Sum=100"

To calculate the percentage of marks, "Custom" value of aggregate attribute will be used. Add 
" OnCustomAggregate='gdvList_CustomAggregate'" event in the rad grid and code will be added in the code behind file to calculate the values.


         <telerik:RadGrid ID="gdvList" runat="server" ShowFooter="True" ShowGroupPanel="true" AutoGenerateColumns="false" OnCustomAggregate='gdvList_CustomAggregate'>  
           <MasterTableView>  
             <Columns>  
                 <telerik:GridBoundColumn DataField="Subject" HeaderText="Subject"></telerik:GridBoundColumn>  
              <telerik:GridBoundColumn DataField="TotalMarks" HeaderText="TotalMarks" Aggregate="Sum" FooterAggregateFormatString="{0:g}">  
              </telerik:GridBoundColumn>  
                 <telerik:GridBoundColumn DataField="MarksObtd" HeaderText="MarksObtd" Aggregate="Sum" FooterAggregateFormatString="{0:g}">  
              </telerik:GridBoundColumn>  
                 <telerik:GridBoundColumn DataField="Per" HeaderText="Per" Aggregate="Custom" UniqueName="Per">  
              </telerik:GridBoundColumn>   
                </Columns>  
           </MasterTableView>  
         </telerik:RadGrid>  

Add following code in the code behind cs file

 protected void gdvList_CustomAggregate(object sender, GridCustomAggregateEventArgs e)  
   {  
     if (((Telerik.Web.UI.GridBoundColumn)e.Column).UniqueName == "Per")  
     {  
       Double TotalMarks= 0;  
       Double MarksObtd= 0;  
       foreach (GridDataItem item in gdvList.MasterTableView.Items)  
       {  
         TotalMarks += Convert.ToDouble(item["TotalMarks"].Text);  
         MarksObtd += Convert.ToDouble(item["MarksObtd"].Text);  
       }  
       e.Result = (MarksObtd/ TotalMarks) * 100;  
     }  
   }  

Thanks and enjoy coding!!

Aggregation in Rad Grid Columns

Posted by : Stranger
Date :Thursday, January 30, 2014
With 0comments

Attaching master page dynamically to a conetnt page

| Tuesday, January 28, 2014
Read more »

As the master page and content page are merged during the initialization stage of page processing, a master page must be assigned before then.
 protected void Page_PreInit(object sender, EventArgs e)  
   {  
     try  
     {  
       if (AdminPages)  
         this.Page.MasterPageFile = "~/Admin.master";  
       else  
         this.Page.MasterPageFile = "~/General.master";  
     }  
     catch (Exception ex)  
     {  
     }  
   }  

The MasterPageFile property can be set only in the PreInit event; attempting to set the MasterPageFile property after the PreInit event will throw an InvalidOperationException exception. If the MasterPageFile property is not valid, an exception of type HttpException is thrown later in the page life cycle, but no exception is thrown when the property is set in the PreInit event.

Attaching master page dynamically to a conetnt page

Posted by : Stranger
Date :Tuesday, January 28, 2014
With 0comments

How to - Populate RadEditor's Apply CSS Class dropdown with custom styles.

|
Read more »
Populate RadEditor's Apply CSS Class dropdown with custom styles.


 <telerik:RadEditor runat="server" ID="RadEditor1" SkinID="DefaultSetOfTools" Height="400px"  
 Width="100%" >  
 <CssFiles>  
    <telerik:EditorCssFile Value="mystyle.css" />  
 </CssFiles>   
 </telerik:RadEditor>  

Comparison between ASP.NET MVC Web Application and ASP.NET website

|
Read more »
ASP.NET Web Forms ASP.NET MVC
ASP.NET WebForms model follows a Page Life cycle. No Page Life cycle like WebForms. Request cycle is simple in ASP.NET MVC model.
As every page (.aspx) has its own controller (code behind i.e. aspx.cs/.vb file), so both are tightly coupled.Hence there is no separation of concerns. View and Controller are neatly separate. Very clean separation of concerns.
Because of this coupled behavior, automated testing is really difficult. Test driven development is quite simple using this approach.Testability is a key feature in ASP.NET MVC. 
ASP.NET web forms maintain state throughout the website.In order to achieve this stateful behavior, viewstate is used. ASP.NET MVC approach is stateless as that of the web. So there is no concept of viewstate.
Statefulness has a lots of problem for web environment in case of excessively large viewstate. Large viewstate means increase in page size. As controller and view are not dependent and also no viewstate concept in ASP.NET MVC, so output is very clean.
ASP.NET Web Forms use Page controller pattern approach for rendering layout. In this approach, every page has its own controller, i.e., code-behind file that processes the request. ASP.NET MVC uses Front Controller approach. That approach means a common controller for all pages processes the requests.
Along with statefulness, Microsoft tries to introduce server-side controls as in Windows applications. Purpose was to provide somehow an abstraction to the details of HTML. In ASP.NET Web Forms, minimal knowledge of HTML, JavaScript and CSS is required. In MVC, detailed knowledge of HTML, JavaScript and CSS is required.
The above abstraction was good but provides limited control over HTML, JavaScript and CSS which is necessary in many cases. Full control over HTML, JavaScript and CSS.
With a lots of control libraries availability and limited knowledge of other related technologies, ASP.NET WebForms is RAD(Rapid Application Development) approach. It's a step back. For developers decrease in productivity.
It’s good for small scale applications with limited team size. It’s better as well as recommended approach for large-scale applications where different teams are working together.

What is the need of Master Pages?

| Saturday, January 18, 2014
Read more »
In Web site development with ASP.NET, the master page is a feature that enables you to define common structure and interface markup elements for your Web site, including headers, footers, style definitions, or navigation bars. The master page can be shared by any of the pages in your Web site, called the Content Page, and removes need to duplicate code for shared elements within your Web site.

Before Master Pages
Every website contains a common layout for most of the pages. Earlier before master pages,layout code was written on every page, which led to code redundancy and it was difficult to maintain also.

The common layout problem can be handled in two ways 
1. Using Master Pages
2. Using User Controls

User controls have few disadvantages
1. Code of User control is compiled again and again every time page loads.
2. Any change to the public environment of the User control needs to update code on the linked pages

Another option is Master Pages.A Master page is a feature that enables you to define common structure and interface markup elements for your Web site, including headers, footers, style definitions, or navigation bars. The master page can be shared by any of the pages in your Web site, called the Content Page, and removes need to duplicate code for shared elements within your Web site.

A master page is similar to an ordinary ASP.NET page except for the top @Master directive and the presence of one or more ContentPlaceHolder server controls. A ContentPlaceHolder
control defines a region in the master page that can be customized in a derived page. ContentPlaceHolder acts as container which holds controls/items defined in the derived pages.

 <asp:ContentPlaceHolder runat="server" ID="mainContent" />  

In the derived pages, server control is used to provide actual content to ContentPlaceHolders of Master Page. The link between placeholders and content is
established through the Content place holder ID.

 <asp:Content runat="server" contentplaceholderID="mainContent">  
 </asp:Content>  

1. In a master page, there can be multiple content place holders.
2. Content page is used to fill the content in their master pages and it should only contain <asp:Content> server control. Everything (like different content) should be
defined in that only.
3. For a given Content place holder, default content can be defined in the master page itself. If it has not been overridden in Content page, the content defined in the master will be
displayed.
4. A placeholder can't be bound to more than one content region in a single content page. If you have multiple <asp:Content> server tags in a content page, each must point to a
distinct placeholder in the master.
5. A ContentPlaceHolder control can be used only in a master page. Content placeholders are not valid on regular ASP.NET pages. If such a control is found in an ordinary Web
page, a parser error occurs.
6. The MasterPage class, in turn, inherits UserControl. So, at the end of the day, a master page is treated as a special kind of ASP.NET user control.


Attributes of @Master Directive

1. Language: This attribute tells the compiler about the language being used in the code-behind. Values can represent any .NET-supported language, including Visual Basic, C#, or JScript .NET.


2. AutoEventWireup: For every page there is an automatic way to bind the events to methods in the same master file or in code behind. The default value is True.


3. CodeFile: Specifies the code-behind file with which the MasterPage is associated.


4. Title: Set the MasterPage Title.


5. MasterPageFile: Specifies the location of the MasterPage file to be used with the current MasterPage. This is used for Nested Master Pages.


6. EnableViewState: Indicates whether view state is maintained across page requests. true if view state is maintained; otherwise, false. The default is true.


7. Inherits: Specifies a code-behind class for the page to inherit. This can be any class derived from the Page class.

Language used in master page and content pages can be different.

Master page can be attached to content page in different ways
1. Page Level
2. Folder Level
3. Application Level

Since Master and Content pages are interdependent, either of the page changes, dynamic assembly needs to be re-created.

When the user requests a page, first it checks whether master page exists or not. If there is any master page, then first master page will be compiled. If the folder consists of multiple master pages, all of them will be compiled at the same time. So when the user access any page for the first, page loading may take a little bit time for compiled, from the next time onwards, it won’t take much time, as master pages are already compiled and cached. When compared to User controls, this is an advantage for master pages as User Controls need compilation every time.

Master pages can be nested. There is no limitation on nesting levels. Nested master pages will have ContentPlaceHolder as well as @MasterPageFile directive.

What is the need of Master Pages?

Posted by : Stranger
Date :Saturday, January 18, 2014
With 0comments

Optics first for LUMUS - Smartglasses at CES 2014

| Tuesday, January 14, 2014
Read more »
The Lumus DK40 is a frame that has more than a passing resemblance to Google Glass, yes, and it does project information on a surface. Yet Lumus, the company behind the yellow, orange, and slate-colored frames, isn't trying to sell the glasses at all. Instead, the Israeli-based company is trying to sell the optics.

The Lumus is a well thought-out working prototpye of a personal head-up display, or HUD -- like the kind you'd find in high-end car dashes and in military equipment.

While many of the other smartglasses here at the show used plastic lenses that obscured my vision, this was crystal clear. And rather than looking at a semi-blurry square image, Lumus' smartframes cast a blue image of any shape in the center of the field of vision for your right eye.
The crew here sprinkled the room with fun easter eggs like mapping coordinates, Twitter posts, a Facebook update, and a Yelp review.


Perhaps the most important difference between the Lumus DK40 and others, apart from using actual glass lenses, is that there'e no fat cube of a beam splitter, or awkward separate projector screen. Lumus, a 13-year veteran in the field, has embedded prisms as part of a coating onto the glass. Though they appear striped when you look at them, your eye glues them together to form a cohesive image.


The optics are definitely Lumus' strong point. Although the actual frames that house the HUD are the most complete and polished here at the show, they're still lopsided, heavy, and -- for me -- ill-fitting. Lumus projects that its optical technology will graduate to commercial frames in about a year or year and a half.

Courtesy - CNET.com
Reference link - http://reviews.cnet.com/wearable-tech/lumus-dk40/4505-34900_7-35833970.html

Optics first for LUMUS - Smartglasses at CES 2014

Posted by : Stranger
Date :Tuesday, January 14, 2014
With 0comments
Next Prev
▲Top▲