google

Newest Post

Showing posts with label Miscellaneous. Show all posts
Showing posts with label Miscellaneous. Show all posts

Code to export the Grid View/Data Grid data into Excel File.

| Friday, February 13, 2015
Read more »
 protected void btnExportToExcel_Click(object sender, EventArgs e)  
   {  
     try  
     {  
       DataTable dt = student.GetDetails("B.Tech").Tables[0];  
       DataGrid GridView1 = new DataGrid();  
       GridView1.DataSource = dt;  
       GridView1.DataBind();  
       Response.Clear();  
       Response.Buffer = true;  
       Response.AddHeader("content-disposition", string.Format("attachment; filename=StudentsBTech.xls"));  
       Response.Charset = "";  
       Response.ContentType = "application/vnd.ms-excel";  
       StringWriter sw = new StringWriter();  
       HtmlTextWriter htw = new HtmlTextWriter(sw);  
       GridView1.GridLines = GridLines.Both;  
       GridView1.AllowPaging = false;  
       GridView1.RenderControl(htw);  
       Response.Output.Write(sw.ToString());  
       GridView1.DataBind();  
       Response.Flush();  
     }  
     catch (Exception ex)  
     {  
     }  
     finally { Response.End(); }  
   }  
   public override void VerifyRenderingInServerForm(Control control)  
   { }  

Code to export the Grid View/Data Grid data into Excel File.

Posted by : Stranger
Date :Friday, February 13, 2015
With 0comments

Convert DataSet or DataTable into JSON in C#

| Tuesday, June 10, 2014
Read more »
 public string ConvertToJSON(DataSet ds)  
 {  
 System.Web.Script.Serialization.JavaScriptSerializer serializer = 
new System.Web.Script.Serialization.JavaScriptSerializer();  
     List<Dictionary<string, object>> rows = 

new List<Dictionary<string, object>>();  
     Dictionary<string, object> row = null;  
     foreach (DataRow dr in ds.Tables[0].Rows)  
     {  
       row = new Dictionary<string, object>();  
       foreach (DataColumn col in ds.Tables[0].Columns)  
       {  
         row.Add(col.ColumnName.Trim(), dr[col]);  
       }  
       rows.Add(row);  
     }  
     return serializer.Serialize(rows);  
 }  

Convert DataSet or DataTable into JSON in C#

Posted by : Stranger
Date :Tuesday, June 10, 2014
With 0comments

How to apply RowFilter on DataView

| Friday, May 9, 2014
Read more »
Following code can be used to apply filter on the DataView

 DataSet ds = new DataSet();  
 ds= GetData();  
 DataView dv = ds.Tables[0].DefaultView;  
 dv.RowFilter = "SrNo='" + txtSNo.Text.Trim() + "'";   


LIKE, AND , OR operators can also be used in the RowFilter of Dataview.

To access the filtered records, each DataRowView of the DataView

 foreach (DataRowView drv in dv)  
       {  
         currentName = Convert.ToString(drv["Name"]);  
       }  



How to apply RowFilter on DataView

Posted by : Stranger
Date :Friday, May 9, 2014
With 0comments

Funny Facts Of IT Profession

| Wednesday, March 26, 2014
Read more »
 









 


(Thanks dressesdotcom for these ultimate facts of my profession. Could not help myself from re-blogging.)

Funny Facts Of IT Profession

Posted by : Stranger
Date :Wednesday, March 26, 2014
With 0comments

ABC's of Technology

| Monday, March 24, 2014
Read more »
ABC's of Technology







  • A = Apple, AIM, AOL, Audacity, Animoto, Avatar
  • B = Bluetooth, Blogspot
  • C = CPU, Core, Classroom 2.0
  • D = Digg, Del.icio.us, Diigo, Dopplr, Disqus, Dabbleboard, DropBox, DropCard
  • E = Explorer, Emule Edu20, Edmodo, Edublogs, Elluminate, Ebay
  • F = Facebook, Firefox, Flickr, FriendFeed, FriendFeed
  • G = Google, Glogster, Gravatar, Goodreads, GetSatisfaction
  • H = Hulu, HIT
  • I = Iphone, Inspiration, Iterasi
  • J = Java, Javascript, Jott, Jing
  • K = K-lite codec, Kazaa, Kidspiration
  • L = Linux, LinkedIn, Lizzer, LMS/LCMS, LibraryThing
  • M = MSN, Magmolia, MySpace, Mashable, MooURL
  • N = Napster, Ning
  • O = Office, OpenOffice, OpenID
  • P = Play Station, Plurk, pbWiki, Plaxo, Pandora, Ping.fm, PollDaddy, PayPal
  • Q = Quicktime
  • R = Rss, reQall, Retaggr, RealPlayer
  • S = SecondLife, Seesmic, Skype, StumbleUpon, SlideShare, Studeous, Screencast, Scribblar
  • T = Tags, Twitter, Tumblr, Technorati, TinyURL
  • U = USB, Utterli, UStream
  • V = Vista, VoiceThread, Vi.sualize,Vimeo, Viddler, Vostu
  • W = Wikipedia, Wikispace, Wordpress, Wordle, Webspiration, WiZiQ, WindowsLive
  • X = XP, Xorg
  • Y = YouTube, Yammer, Yugma
  • Z = Zuma, Zoho, Xing, Zillow
  • @ = e-Mail
  • Smiley = IMs - AOL AIM, Windows Live Messenger, Yahoo IM

  • ABC's of Technology

    Posted by : Stranger
    Date :Monday, March 24, 2014
    With 1 comments:

    Amazing Facts that might OMG you@@

    |
    Read more »

    SunRay SX2 golf cart: 72 photovoltaic solar cells on the roof power the 48-volt battery of this golf cart. The golf cart is priced at about $9,000. The golf cart can travel at a speed of 24 mph and can cover 49 miles.





















    Thats GROSS!!!


    (Thanks to the resource websites.)

    Amazing Facts that might OMG you@@

    Posted by : Stranger
    Date :
    With 0comments

    ScriptManager.RegisterStartupScript using JavaScriptSerializer - To display the Alert or Message Box from Code behind

    | Thursday, March 13, 2014
    Read more »
    While registering a message using the javascript code in RegisterStartupScript, message might contain some escape characters like ' or " this will definitely break the javascript. Hence we need to encode it, for example using JavaScriptSerializer as follows.



      string message = new JavaScriptSerializer().Serialize(ex.Message.ToString());  
      string myScript = String.Format("alert('{0}');", msg);  
      ScriptManager.RegisterStartupScript(page, page.GetType(), "MyScript", myScript, true);  
    




    TextBoxMode Enumeration or TextMode attribute of TextBox

    | Thursday, February 20, 2014
    Read more »
    The TextBoxMode enum specifies the behavior mode of the ASP.NET web control textbox. This is specified in the TextMode attribute of TextBox control.

     <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>  
    

    "TextMode" attribute or "TextBoxMode" enum represents the different display options of the TextBox.

    • SingleLine - displays the textbox in a single row. If text exceeds the physical size of the control, it automatically adds scroll to the textbox
    • MultiLine - displays the height and length of the textbox based upon the Rows and Columns of the textbox. It allows text entry in multiple lines. Data entered in multiline textbox can be wrapped if Wrap property is set to true.
    • Password - similar to SingleLine except the all characters entered in Textbox are masked and not saved in viewstate.
    There are other options also for TextMode attribute of textbox control like Email, Number, Date, DateTime etc. but they correspond to the type attribute of input element in the HTML5 hence not supported in other versions of html.

    TextBoxMode Enumeration or TextMode attribute of TextBox

    Posted by : Stranger
    Date :Thursday, February 20, 2014
    With 0comments

    How to use Built-in Content Filters of RadEditor to enable Absolute URLs

    | Thursday, February 6, 2014
    Read more »
    RadEditor provides feature to upload images, documents, videos etc along with the content. The default path for uploading and viewing these attachments is the path relative to the website.

    To make the path absolute for certain situations, add ContentFilters="MakeUrlsAbsolute" attribute to the RadEditor as follows.


      <telerik:RadEditor runat="server" ID="RadEditor1" SkinID="DefaultSetOfTools" Height="400px" ContentFilters="MakeUrlsAbsolute"  
             Width="100%" CssClass="addeditor">  
             <Content>  
             </Content>  
             <ImageManager ViewPaths="~/Upload" UploadPaths="~/Upload" DeletePaths="~/Upload"></ImageManager>  
             <DocumentManager MaxUploadFileSize='2100000' ViewPaths="~/Upload" UploadPaths="~/Upload" DeletePaths="~/Upload"></DocumentManager>  
           </telerik:RadEditor>  
    

    It will make all src attributes in the editor content to have absolute URLs

    How to use Built-in Content Filters of RadEditor to enable Absolute URLs

    Posted by : Stranger
    Date :Thursday, February 6, 2014
    With 0comments

    Kolibree Bluetooth toothbrush helps improve the brushing technique through the power of its app

    |
    Read more »
    The Kolibree toothbrush has an accelerometer, a gyroscope, and a magnetometer inside, which it uses to record how long you brush your teeth for, and how you brush them.It can send this information to an Android phone or iPhone via a Bluetooth wireless connection.



    The Bluetooth toothbrush from Kolibree

    It can show you live information on how you're doing so you can adjust your brushing technique, or simply brush for longer. Or it can sync that information with a phone app to give you a running total of how well you've brushed.
    You end up looking at a screen that gives you a score out of five that's based on how long and well you've cleaned your teeth.

    Silliest is it has the ability to set up different family members in one app and track them separately, with the app generating a graph showing how well you brush compared with everyone else.

    generate a graph to pit your brushing habits against the rest of the family

    Its kind of having a personal dentist actually watching you brushing on a day-today basis.It can be useful only in one way : for kids.

    Toothbrush will go on sale this summer (summer 2014) and will be priced from $99 to $199 depending upon the features (whoopp!!!).

    Courtesy - CNET, CES 2014

    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

    Earth Day 2013: Google doodles ‘change of seasons’

    | Monday, April 22, 2013
    Read more »

    Earth Day 2013: Google doodles ‘change of seasons’

    Posted by : Stranger
    Date :Monday, April 22, 2013
    With 0comments

    Crunched For Time: 8 Time-Saving Tips For Your Job Search

    | Monday, April 8, 2013
    Read more »

    Crunched For Time: 8 Time-Saving Tips For Your Job Search

    Posted by : Stranger
    Date :Monday, April 8, 2013
    With 0comments

    BlogEngine.NET - An innovative open source blogging platform developed with ASP.NET

    | Friday, April 5, 2013
    Read more »
    BlogEngine.NET - An innovative open source blogging platform developed with ASP.NET

    Features

    Here's a short list of all the features of BlogEngine.NET
     
    Plug ’n play
    BlogEngine.NET is very easy to setup and customize. To make it work, just upload the files to an ASP.NET 4.0 webserver and you’re ready to start writing. No database configuration, just plug ‘n play.

    Full featured
    BlogEngine.NET comes with all the features you would expect from a modern blog engine as well as new unique features such as AJAX comments and screenshot trackbacks.

    Web 2.0
    BlogEngine.NET features social bookmarks, OpenSearch support, XFN tags, AJAX, FOAF, SIOC, APML, Gravatars, coComments, tag cloud, Google sitemap and other so called Web 2.0 features.

    Referrer stats
    The referrer statistics enables you to see which websites link to you, so you can follow up with comments or just to have fun. This feature is a real time killer that you cannot live without.
     
    Cool widgets
    There is a variety of cool widgets that such as an AJAX post calendar or a blogroll that automatically retrieves the latest posts from each blog and displays the title beneath the blog. Most of the controls are configurable from the admin section.

    Advanced comment system
    Comments are a very important part of a blog, so BlogEngine.NET features a very advanced commenting system in AJAX that supports country flags, live preview, Gravatars, coComments – all of which can easily be modified in the admin section.

    Full syndication suite
    BlogEngine.NET supports syndication feeds in any possible location. You can find feeds on comments, categories, authors and a main feed. Both RSS 2.0 and ATOM 1.0 are fully supported.
     
    Trackbacks and pingbacks
    All outgoing links from the posts is tracked- and pinged back, so your blog will get listed in the comments on the linked website if it supports it. When a new post is created, BlogEngine.NET automatically pings Technorati, Feedburner, Ping-o-Matic etc.
     
    Search
    The search capability of BlogEngine.NET is one of the most advanced and it even allows the visitors to search in the comments. Everything about the search can be configured in the admin section.

    Standalone pages
    Besides regular blog posts, BlogEngine.NET supports the creation of static pages that exist outside the blog chronology. Pages are useful for all kinds of information about you or your blog.
    Multi-author support 
    Multi-author support
    BlogEngine.NET fully supports multiple authors to write posts on the same blog. Visitors are then able to subscribe to the individual author’s RSS feed or view only the posts from their favourite author.

    Cool themes
    BlogEngine.NET comes with some very cool themes for you to choose from. If you want to modify or create a new theme you can do so easily with just a basic understanding of HTML and CSS.
     
    XHTML compliance
    All the controls in BlogEngine.NET are 100% XHTML 1.0 compliant. All posts you write automatically become compliant thanks to the tinyMCE text editor.

    Extendable
    BlogEngine.NET is built from the ground up using nothing but C# and ASP.NET 4.0 all with simplicity in mind. It means that you can write new controls and themes by using the skills you already have as a .NET developer.

    BlogEngine.NET - An innovative open source blogging platform developed with ASP.NET

    Posted by : Stranger
    Date :Friday, April 5, 2013
    With 0comments

    JOBS vs RITCHIE

    | Monday, April 1, 2013
    Read more »




    JOBS vs RITCHIE

    Posted by : Stranger
    Date :Monday, April 1, 2013
    With 0comments

    Free Microsoft .net Technology Online Training: How it works for Trainers?

    | Thursday, March 21, 2013
    Read more »

    Free Microsoft .net Technology Online Training: How it works for Trainers?

    Posted by : Stranger
    Date :Thursday, March 21, 2013
    With 0comments

    Top HR Interview Question - Tell Me About Yourself??

    | Thursday, February 28, 2013
    Read more »
    Do you know why this question is asked so often in most job interviews? This question is actually an ice-breaker. Asking this question starts the conversion. So you should better be ready with an answer. This question gives the interviewer a chance to know about the interviewee. Once you start talking about yourself, interviewer starts preparing his/her next question. So there are high chances that the next question that would be fired on you will be based on the answer of this question. As the answer for this will be based on you, you think and prepare it before the interview.

    While preparing for the answer consider including following points.
    1. You:
    Tell them your name and which place you are from. Suppose you are “Mike Creamer”, then do not start with “Myself Mike Creamer”; start with “I am Mike Creamer”. This is a very common mistake. Not acceptable in interviews especially in call center jobs.
    You may talk about your family (cover up in short); you may talk about your how you came to the city, etc.

    2. Your education:
    Tell them about your education i.e. graduation/post-graduation. If you are a fresher then tell them the grades you got. If you have done something different than others then tell them. It surely adds a value!

    3. Your experience:
    Talk about your whole experience. Start from early years and gradually come to recent years. If you have a long experience then you must not be doing same thing all years. Then exactly what you were doing? This is what your interviewer wants to listen. If you are a fresher then talk about your projects.

    4. Your experience regarding to the post you has applied for:
    This is of most interest to your interviewer. You may be having lot of experience but how much experience you have regarding current job post is very important. If you do not have it then you can talk about some related experience. Or if you do not have related experience too then say it clearly. Buy along with it give them confidence that you can do it and you have genuine interest to do it.

    Fresh candidates who do not have any kind of experience, you should show some positive attitude and exhibit willingness to learn and do new things. Be ready to do new things. Don’t worry that you will make mistakes. Fresher candidates are expected to do mistakes and your employers are well aware of it so you don’t have any reason to be afraid. Believe me no one will give you more work than you can handle.



    5. Do not describe your salary or pay scale at this point of time (unless explicitly asked).

    6. Avoid giving unnecessary details. Value your interviewer’s time.

    7. The idle answer should not last more than 1 minute.

    Good luck.

    Article from - http://careercounselings.net/top-hr-interview-question-tell-me-about-yourself/

    Top HR Interview Question - Tell Me About Yourself??

    Posted by : Stranger
    Date :Thursday, February 28, 2013
    With 0comments
    Prev
    ▲Top▲