Advertisements
Showing posts with label Website. Show all posts
Showing posts with label Website. Show all posts

Sunday, September 21, 2014

// // Leave a Comment

Feeling Awesome - Thank You

Whooo!

We are about to reach 1,00,000 Hits on this domain only.
Combined stats is about to reach 1,40,000 hits. 
This blog got 80,000 hits in last 8 months since our last announcement on 20 January 2014 on average of 10,000 hits per month. 

Keep supporting and your feedback are most welcome. 

Thanks from 
P.Yar.B Complex
Read More

Friday, August 15, 2014

// // Leave a Comment

Happy Independence Day

Hi,

Wishing all my Indian Friend living in India and abroad a very happy Independence Day. Memorize the struggle done by leaders and Martyr.

-
From P.Yar.B Complex
Read More

Friday, May 30, 2014

// // Leave a Comment

HTTP Error 500.23 - Internal Server Error - Solution 2

Hi,

If you keep visiting here, some days ago, I have posted a same post here. The problem is similar again but difference is another way to solve the same problem.
Lets have a look at fresh snapshot.

HTTP Error 500.23 - Internal Server Error

An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.

Most likely causes:

  • This application defines configuration in the system.web/httpHandlers section.

Things you can try:

  • Migrate the configuration to the system.webServer/handlers section. You can do so manually or by using AppCmd from the command line - for example, %SystemRoot%\system32\inetsrv\appcmd migrate config "Default Web Site/". Using appcmd to migrate your application will enable it to work in Integrated mode, and continue to work in Classic mode and on previous versions of IIS.
  • If you are certain that it is OK to ignore this error, it can be disabled by setting system.webServer/validation@validateIntegratedModeConfiguration to false.
  • Alternatively, switch the application to a Classic mode application pool - for example, appcmd set app "Default Web Site/" /applicationPool:"Classic .NET AppPool". Only do this if you are unable to migrate your application.
(Set "Default Web Site" and "Classic .NET AppPool" to your application path and application pool name)

If you are still confused about the previous post, here is the link.
http://www.pyarb.com/2014/02/http-error-50023-internal-server-error.html

Problem

Last time, we received the similar problem while debugging from Visual Studio, this time it is produced by IIS itself after publishing.

Solution

We will add small piece of code into web.config file. This can be done using two methods. Either you open any text-editor (notepad) with Administrator Privilege and open web.config from your IIS root or change the setting in Visual Studio web.config and publish again. What you want to is totally on you.
Piece of Code:
......
<system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
    </system.webServer>
</configuration>


Place this code inside configuration node. Also, this will not harm you in case of security, This will just tell not to check such settings which are not required.
Thanks for reading. Do not forget to share or provide feedback.
+John Bhatt

Read More

Friday, May 16, 2014

// // Leave a Comment

Update on Download Center

Hi,

Sorry for the interruption on services of Download Center. Due to some technical mistakes with our web-host and application, all our download files are removed. However, we have all songs available for listening.

Now instead of relying on WordPress and PHP, these days me and my team is busy to develop a CMS based on ASP.NET for Download Center.

We will be back soon.

From
P.Yar.B Complex
Read More

Tuesday, May 6, 2014

// // Leave a Comment

CSS - Cascaded Style Sheet : Part 2 (Selectors)

Hi,

In my previous article, I have written about Introduction of CSS and its basics. In continuation of CSS Tutorial series, this post will help you learning about SELECTOR. We will discuss here for beginners so that they can get maximum and understand the basic difference of their types.

Introduction:

In a embedded or External style sheet, the target element is not fix. Basically we write CSS in embedded or External mode so that we can re-use it when required and can modify whole look of page or website by modifying CSS file only. For using multiple CSS values and properties, we need Identifiers which are called Selector in CSS. Just as In case of C we write a function and use it anywhere, the SELECTOR are same. You will understand more by its example. As per CSS Rule, Selector are divided in three types.

HTML Selector:

HTML Selector are part of HTML Tags. They need not to be used at HTML/XHTML syntax. In short we can define style sheet for any of the markup tags which is used in document but we can not create our own selector of this kind. 
Example:
/* HTML Selectors */
 h1
 {
  font-family: Verdana, Calibry, Tahoma;
  color:green; /* You are strictly suggested to use Hexa color code. Ex. #ff0000 etc. */
  font-size:21px;
  text-decoration: bold;
 }
 
 h2
 {
  font-family: Verdana, Calibry, Tahoma;
  color:blue; /* You are strictly suggested to use Hexa color code. Ex. #ff0000 etc. */
  font-size:18px;
  text-decoration: underline;
  text-align:center;
 }
 
 p
 {
 font-family: Verdana, Calibry, Tahoma;
 text-align:justify;
 padding: 4px 4px 4px 4px;
 }

Class Selector:

Class selector are selectors which need to be used  with class tag in HTML or similar tag in various language. These start with period/dot (.) symbol. These can be used unlimited times in documents and need to be defined each time for markup syntax. You are free to choose name of selector.
Example:
 /*  Class Selectors */
 .textBox
 {
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    padding-right: 10px;
    padding-left: 6px;
    padding-top: 2px;
    padding-bottom: 2px;
    font-family: Calibri,Tahoma,Verdana,'Segoe UI';
    border: solid 1px black;
    font-size: 13px;
    text-decoration: none;
    margin-left: 0px;
 }
 
 .button
 {
    font-family: Calibri,Tahoma,'Segoe UI',Verdana, Geneva, 'DejaVu Sans', sans-serif;
    border-top: 1px solid #dec227;
    background: #ffd800;
    background: -webkit-gradient(linear, left top, left bottom, from(#3e779d), to(#65a9d7));
    background: -webkit-linear-gradient(top, #ffd800, #65a9d7);
    background: -moz-linear-gradient(top, #ffd800, #65a9d7);
    background: -ms-linear-gradient(top, #ffd800, #65a9d7);
    background: #ffd800;
    padding: 1px 4px;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    text-shadow: rgba(0,0,0,.4) 0 1px 0;
    -webkit-text-shadow: rgba(0,0,0,.4) 0 1px 0;
    color: white;
    font-size: 13px;    
    text-decoration: none;
    vertical-align: middle;
    height: 27px;
 }

ID Selector:

ID Selector are based upon ID of element. These are initialized with Pound or Hash (#) sign. These can be used only once in a document as the ID of attribute must be unique as per document markup standard. These need not be assigned with attribute but remember, the ID of document element should be same as ID defined in selector. They typography case (lowercase/uppercase) is sensitive here.
Example:
 /* ID Selectors  */
 
 #footer {
    font-family: Calibri,Tahoma,Verdana,'Segoe UI';
    font-size: 15px;
    color: red;
    background-color: #ffd800;
	text-align:center;
}
For you, here is the complete code of HTML Page which is as shown in above screenshot.
<html>
<head>
<title>CSS Stylesheets & Selectors </title>
<style>
/* HTML Selectors */
 h1
 {
  font-family: Verdana, Calibry, Tahoma;
  color:green; /* You are strictly suggested to use Hexa color code. Ex. #ff0000 etc. */
  font-size:21px;
  text-decoration: bold;
 }
 
 h2
 {
  font-family: Verdana, Calibry, Tahoma;
  color:blue; /* You are strictly suggested to use Hexa color code. Ex. #ff0000 etc. */
  font-size:18px;
  text-decoration: underline;
  text-align:center;
 }
 
 p
 {
 font-family: Verdana, Calibry, Tahoma;
 text-align:justify;
 padding: 4px 4px 4px 4px;
 }
 
 
 /*  Class Selectors */
 .textBox
 {
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    padding-right: 10px;
    padding-left: 6px;
    padding-top: 2px;
    padding-bottom: 2px;
    font-family: Calibri,Tahoma,Verdana,'Segoe UI';
    border: solid 1px black;
    font-size: 13px;
    text-decoration: none;
    margin-left: 0px;
 }
 
 .button
 {
    font-family: Calibri,Tahoma,'Segoe UI',Verdana, Geneva, 'DejaVu Sans', sans-serif;
    border-top: 1px solid #dec227;
    background: #ffd800;
    background: -webkit-gradient(linear, left top, left bottom, from(#3e779d), to(#65a9d7));
    background: -webkit-linear-gradient(top, #ffd800, #65a9d7);
    background: -moz-linear-gradient(top, #ffd800, #65a9d7);
    background: -ms-linear-gradient(top, #ffd800, #65a9d7);
    background: #ffd800;
    padding: 1px 4px;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    text-shadow: rgba(0,0,0,.4) 0 1px 0;
    -webkit-text-shadow: rgba(0,0,0,.4) 0 1px 0;
    color: white;
    font-size: 13px;    
    text-decoration: none;
    vertical-align: middle;
    height: 27px;
 }
 
 /* ID Selectors  */
 
 #footer {
    font-family: Calibri,Tahoma,Verdana,'Segoe UI';
    font-size: 15px;
    color: red;
    background-color: #ffd800;
	text-align:center;
}
</style>
</head>
<body>
<H1>Types of Selectors in CSS</H1>
<p>In this topic we will be discussing about different types of Selectors in CSS (Cascaded Style Sheets). You will learn about all kind of selectors with examples at the last of this post.</p>
<h2>1. HTML Selector</h2>
<p>As on this line, we did not applied any of stylesheet tags (class or ID). But you will see the changes in style of H1 , H2 and P tag. These are HTML Tags and automatically used by HTTP Web server as they are present in stylesheet.<p>
<h2>2. Class Selectors</h2>
<input type="text" class="textBox" name="FirstName" value="Enter your first Name." />
<input type="button" class="button" name="Submit" value="Click to Submit" />
<p>In above two lines we used class="textbox" and class="button". As in above stylesheet we have created them with period (.) and used with class attribute of HTML element, so these are called Class selectors.</p>
<h2>3. ID Selector</h2>
<p>We will be applying these settings in last of this webpage where we will write footer.</p>
<div id="footer">All Rights are reserved.</div>
</body>
</html>
Thanks for reading. I will be back with another article in CSS series. Your suggestions or feedback are expected and play great role in our development. Keep reading, writing & sharing.
John Bhatt
Read More

Saturday, May 3, 2014

// // Leave a Comment

CSS - Cascaded Style Sheets : Part 1

Hi,

This time, as we did in beginning for HTML, I am back with CSS Tutorial. This post will contain all information about Cascaded Style Sheets, commonly known as CSS.

Introduction:

CSS is used to decorate HTML elements. This is developed by W3C, Bert Bos, Hakon Wium Lie. In other words it is a scripting language written in any text editor that is used to describe look and formatting of hypertext document. However this is present in all kinds of documents that are written in any markup languages including HTML. Latest version is CSS 4 which is in early stage in current days. CSS Statement is divided in 3 parts in simple.
This is written between STYLE tags or with STYLE attribute if any HTML Keyword. Style tag is container/closed tag of HTML.

Example

text-align : left ;

Property: These are fixed set of keywords which define property of element. In above example text-align is property.
Separator: This separates property and value and always presented by : (colon).
Value: This is the value to property. In above case left is the value of property text-align.

Using Method:

Based on using method, CSS is classified in two parts. One is Internal and other External.
  1. Internal: In this method, we write all CSS markup inside the same file where it is applied. This is also done in two methods. 
    • Inline CSS: In this method, CSS is written inside the HTML or XHTML statement using STYLE tag. 
    • Block CSS: In this method, we write CSS code in HEAD section of HTML document between STYLE tag.
  2. External: In this method, we write all CSS markup in another file and insert reference to the file in required HTML file using LINK tag.
    Example:
     <link href="path/to/file.css" rel="stylesheet">
Apart from this, we have another term in CSS which is called SELECTOR.
Selector are simply collection of CSS attributes and their value. Selectors are used in HTML using CLASS or ID or with HTML tag. So further CSS Selector are divided in 3 parts.
We will discuss about all kind of CSS Selector in another post. Before this let me show you an example of CSS used in all methods.

<html>
<head>
<title>Introduction to CSS</title>
<style type="text/css">
h1
{
    font-family: Calibri,Tahoma,Verdana, Geneva, 'DejaVu Sans', sans-serif;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
}
</style>

<link href="styles/main.css" rel="stylesheet" />

</head>
<body>
<h1>Introduction to CSS</h1>
<p style="text-align: justify;">This is random text in paragraph.Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries. Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme. Save time in Word with new buttons that show up where you need them. To change the way a picture fits in your document, click it and a button for layout options appears next to it. When you work on a table, click where you want to add a row or a column, and then click the plus sign. Reading is easier, too, in the new Reading view. You can collapse parts of the document and focus on the text you want. If you need to stop reading before you reach the end, Word remembers where you left off - even on another device.</p>
</body>
</html>

Keep reading for next part.
John Bhatt
Read More

Wednesday, March 12, 2014

// // Leave a Comment

Print GridView only in ASP.NET

Hi,

Lets come back to ASP.NET tips and trick series. We are once again going to learn new trick related to GridView. Previously I have posted following articles related to GridView.

Requirement

Suppose, you have a page where you are displaying any kind of data to user. You want to add a functionality to print these records. But problem with Browsers Default Print options (Ctrl+P) is that, it will print whole page. All header images, footer, sidebar and colors will printed, which is not required. You have two options, either create a new page for print view and redirect user to that page or just print the required area, in our case it is GridView. 
Most of developer working in a web applications have MasterPage for their web-application. MasterPage are similar to templates in normal HTML having some advanced functionality and customized code for maintaining easier and common look of website or application.
Lets have a look at below screen to make our requirement more clear.

Code for Default.aspx

This is the code for GridView.
   <asp:GridView runat="server" ID="gvProducts" AutoGenerateColumns="false" AllowPaging="false" AlternatingRowStyle-BackColor="Linen" HeaderStyle-BackColor="SkyBlue" Width="100%" OnPageIndexChanging="gvProducts_PageIndexChanging" EmptyDataText="Sorry! No Products to List. First Add from Add Product Link.">
                    <Columns>
                        <asp:TemplateField HeaderText="Product ID">
                            <ItemTemplate>
                                <asp:Label ID="lblProductID" runat="server" Text='<%#Eval("ProductID")%>' ToolTip="ID of Product as stored in Database."></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <Columns>
                        <asp:TemplateField HeaderText="Product Name">
                            <ItemTemplate>
                                <asp:Label ID="lblProductName" runat="server" ToolTip="Name of Product" Text='<%#Eval("ProductName")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <Columns>
                        <asp:TemplateField HeaderText="Brand">
                            <ItemTemplate>
                                <asp:Label ID="lblBrandName" runat="server" ToolTip="Brand of Product" Text='<%#Eval("BrandName")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <Columns>
                        <asp:TemplateField HeaderText="Category">
                            <ItemTemplate>
                                <asp:Label ID="lblProductCat" runat="server" ToolTip="Category of Product" Text='<%#Eval("CategoryName")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <Columns>
                        <asp:TemplateField HeaderText="In Stock">
                            <ItemTemplate>
                                <asp:Label ID="lblProductinStock" runat="server" ToolTip="Quantity available in Stock"
                                    Text='<%#Eval("UnitsInStock")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>

Code for Default.aspx.cs

We do not have much more at backend, we are just going to bind data to GridView.
 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConToStore"].ConnectionString);
            SqlDataAdapter adp = new SqlDataAdapter("Select * from Products,Brands,Category where Products.BrandID=Brands.BrandID and Products.CategoryID=Category.CategoryID", con);
            DataSet ds = new DataSet();
            adp.Fill(ds);
            gvProducts.DataSource = ds.Tables[0];
            gvProducts.DataBind();
        }
    }

Printing Page.

Lets press Ctrl+P key combination to print page, before printing see the Preview.

Printing GridView Only

We need to make following change to print GridView only. Lets start with HTML.
Wrap the GridView inside a Table or Panel. I am using Table. You can also go with Panel.
  <table width="70%" id="pnlGridView" runat="server" align="center" class="ContentTable">
        <tr>
            <td colspan="2" align="center">
                <h1>All Products in Store</h1>
            </td>
        </tr>
        <tr>
            <td> </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:GridView runat="server" ID="gvProducts" AutoGenerateColumns="false" AllowPaging="false" 
    AlternatingRowStyle-BackColor="Linen" HeaderStyle-BackColor="SkyBlue" Width="100%" 
    OnPageIndexChanging="gvProducts_PageIndexChanging" 
    EmptyDataText="Sorry! No Products to List. First Add from Add Product Link.">
                    ...............
     .............
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:LinkButton ID="lnkPrint" runat="server" ToolTip="Click to Print All Records" Text="Print Data" OnClick="lnkPrint_Click"></asp:LinkButton>     
                <asp:LinkButton ID="lnkExportAll" runat="server" ToolTip="Export this List" Text="Export to Excel" OnClick="lnkExportAll_Click"></asp:LinkButton>
                     
                <asp:LinkButton ID="lnkAddNew" runat="server" ToolTip="Add New Product"
                    Text="Add New" OnClick="lnkAddNew_Click"></asp:LinkButton>
            </td>
        </tr>
    </table>
Now just add following JavaScript function in head section and assign that function to Print linkbutton.
    <script language="javascript" type="text/javascript">
        function PrintPage() {
            var printContent = document.getElementById('<%= pnlGridView.ClientID %>');
            var printWindow = window.open("All Records", "Print Panel", 'left=50000,top=50000,width=0,height=0');
            printWindow.document.write(printContent.innerHTML);
            printWindow.document.close();
            printWindow.focus();
            printWindow.print();
        }
    </script>
Now lets click on Print Link button which we have created. Following will be output for above code.

Bingo! It was the requirement.
Hope you enjoyed reading. If you have any feedback or suggestions, please send us as comment or using contact options. Keep sharing.
John Bhatt
Read More

Wednesday, February 26, 2014

// // Leave a Comment

Adding META Keyword Dynamically in Blogger

Hi,

Welcome back to our Blogger Tutorial series. Most of the blogger have good knowledge of SEO. They have used various blogging platform and use different plugin for SEO enhancement. Search Engine Optimization, commonly known as SEO is a method or way or process of effecting the visibility of your website among different Search Engines for better traffic and ranking. There are many paid advertisements among different Search engine but they are not considered part of SEO.
Whatever they do, coming back to our topic, we are talking about Keywords. META description and Keyword are the best approach for search engine. META description show the excerpt of your post or blog while searched. And Keywords are useful to match with the query text from user in search box. Lets illustrate using below graphical presentation.

But if you are using Blogger, there is no plugin for making your blogs SEO better, you have to do it yourself. If this article, I will tell you, how to add META Keywords dynamically according to post in your Blogger blog. You can set static keywords by modifying template code in simple steps but adding dynamic content is somehow tricky. 

Dynamic Meta Keywords

Lets move to work. Start with logging into blogger. Points are described step by step.

  1. Click in Template Link in Left side.
  2. Click on Backup / Restore button at right corner.
  3. Click on Download Full Template and save at safe place. In case something goes wrong, you will need this before cursing me.
  4. Now click in Edit HTML button just below snapshot preview of your blog template.
  5. Search in Template using CTRL+F and find for keywords.
  6. If there is already a link containing Meta Keyword, replace its value with below one or if there is no keyword then search for </title> and add below line just below that.
    <b:if cond='data:blog.metaDescription != ""'>
         <meta expr:content='data:blog.pageName + ", " + data:blog.title' name='Keywords'/>
    </b:if> 
    
  7. Save your template.
If you have following all steps I mentioned, congratulation you have successfully set your post title as keyword in Blogger. You can check this by viewing source code in your browser.

In our next post in this series, we will be discussing about how to add Labels in Blogger Meta Keyword section dynamically? Till then, keep reading. Do not forget to share or provide feedback.

All the Best.
Read More

Thursday, January 30, 2014

// // Leave a Comment

Adding CommentLuv in Blogger

Hi,
Once again, a new post for all blogger friends. As you are aware, the quality back-link has great value in website ranking. Most of blogger want to increase their ranking on various measurement tools and follow many tricks. They use many tools available over internet.

CommentLuv / IntenseDebate

In case of blog, one of the most used and must have feature is comment system. You should know what your visitor think about your post, so there should be a commenting system which is powerful, can protect spam, give you ability to control them and other administration features. Disqus is one of the most used commenting system. Another powerful and most used commenting platform is CommentLuv from IntenseDebate. This is an Automattic product. Automattic is company which made WordPress, JetPack, Askimet and other web products which are used by approx 70-80 % of web-masters. So by default, CommenLuv comes with Askimet spam protection which is actually powerful and blocks spam without any extra effort. Best thing about IntenseDebate is it is free. We will learn how to integrate CommentLuv comments with blogger template so that our blog can display and work with IntenseDebate commenting system.

Procedure

  1. Open http://intensedebate.com/signup.
  2. Fill the required details, If you have already got a WodPress.com account, you can login using WordPress API.
  3. If you are registering for first time, you must confirm your email id. Check you inbox and confirm email.
  4. Login to intensedebate.com using your username/password.
  5. Click on Sites menu and choose Add Blog/Site or navigate to https://intensedebate.com/install

  6. Put the domain of your blog. They have great support for Blogger. You can put your custom domain or blogger.com domain name and click next.
  7. This is choose your platform screen. Currently they have automated tools for WordPress.org, TypePad, tumblr and Blogger. Click on Blogger button. Remember, classic blogger is not supported.
     
  8. Now the next step is to login to blogger. Remember, you are using Modern version of Blogger. Navigate to Template section.
  9. Click on Backup/Restore button on right top corner. 
  10. You will be asked to download the template or upload. Click on "Download Full Template" button.
  11. Save this XML file (blogger template) to hard disc. Now navigate back to IntenseDebate website.
  12. Next screen is installer screen for blogger. There are some steps. They will ask you either you want to put commenting system in all posts or in new posts only. Selecting All posts will delete all older comments made using Blogger comment system. So this is not recommended if you have lots of comments in website earlier.
  13. There is a File Upload button in Step 5, click on button, upload your newly saved XML template. The rest is on IntenseDebate.
  14. Once file is uploaded, they read content and place all settings and codes themselves in template and write all code in a textbox.
  15. Now copy all that text and navigate to blogger. Click on Edit HTML button. 

  16. Replace all content in editor and click on Save Template button. Your all existing script customizations, texts, widgets will remain same and as per your settings, you can see the IntenseDebate commending system enabled in your blog posts.
You have successfully completed the installation of IntenseDebate commending system in your blogger powered blog. Leave feedback about your reading experience. Your feedback will help us to improve.

Thanks for reading.
Read More

Thursday, January 23, 2014

// // 3 comments

RichTextBox in a single textbox among multiple TinyMCE

Hi,
Some time ago, I have written an post about integration of TinyMCE editor in ASP.NET website. The same was also published in CodeProject and most visited article of mine. While answering comments there, I got a request from one of reader.
His question is, "I have used TinyMCE Rich TextBox in my application but in my web form i have mulitple mulitiline TextBox. what I want that Rich TextBox should be bind to only one text box not all TextBoxes."

Situation

So the solution is here. Lets create a scene as below.

Here we have to convert TextArea for about to Rich Text Editor (WYSIWYG). Lets view source code of above design. I have tried to use simple HTML5 tags. So that other users can also get advantage of this tutorial.
 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>Rich Text Editor in Single TextArea among many</title>
</head>
<body>
    <form id="form1" runat="server">
        <h1>Rich Text Editor in Single TextArea among many</h1>
        <fieldset>
            <legend>Profile Update</legend>
            <p>
                <label>Name</label>
                <input type="text" id="txtName" runat="server" />
            </p>
            <p>
                <label>Gender</label>
                <input type="radio" name="Gender" id="radioMale" runat="server" value="Male" />
                <input type="radio" name="Gender" id="radioFemale" runat="server" value="Female" />
            </p>
            <p>
                <label>Email ID</label>
                <input type="text" id="txtEmail" runat="server" />
            </p>

            <p>
                <label>About</label>
                <textarea rows="5" cols="50" id="txtAbout" class="Editor" runat="server"></textarea>
            </p>
            <p>
                <label>Remarks</label>
                <textarea rows="2" cols="50" id="txtremarks" runat="server"></textarea>               
            </p>
            <p>
                <asp:Button ID="btnSubmit" Text="Submit" runat="server" />
                <input type="reset" value="Clear Form" runat="server" />

            </p>
        </fieldset>

    </form>
</body>
</html>
Here we are using TinyMCE version 4.0.xx. This version is major upgrade and has completely different look and internal architecture compared to version 3.xx. So here is some difference in its integration.
If you are not familiar with this process, please read our previous post, that will describe you about Copying required files in project directory and inserting script in more details. Insert below code before closing of head tag in your HTML page.
<script src="script/tinymce/tinymce.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        tinymce.init({
            selector: ".Editor",
            theme: "modern",
            plugins: ["lists link image charmap print preview hr anchor pagebreak"],                        
        });
    </script>
</head>

Notable

Notable and new code in above integration script is selector tag. This is new included tag in TinyMCE version 4.0.xx. This gives us below options.
Do not forget to change the path to Script as per you folder structure.
  • selector : "textarea"

    : This option will convert all TextAreas in visual editor. 
  • selector : "textarea.Editor"

    : This option will select all TextAreas with CSS Class Editor applied.
  • selector : h1.Editor

    or div.Editor : This option will change this to Inline editor for H1 or DIV with CSS class name of Editor.
As you see in code of scene designed above. you can see that we have applied class Editor which we did not created in any css file to one of the TextArea. Here we used this method.

Older Version

If you are working with TinyMCE version 3.xx, here is the code to be inserted in Head section of HTML page. 
 <script type="text/javascript" 
src="script/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript" language="javascript">
        tinyMCE.init({
            // General options
            
            // mode: "textareas",
    
    // Set mode to Exact.                       
            mode: "exact",  
            
            // Write the name of ID of TextArea where you want editor to appear in element property.
            elements : "txtRemarks", 

            theme: "advanced",
            plugins: "pagebreak,style,layer,table,save,
            advhr,advimage,advlink,emotions,iespell,inlinepopups",
           
        });
    </script>

Output


Now, the output of above work is below.
Its perfect.
If you find this article helpful, drop a comment or share with your friend.
+John Bhatt

Read More

Monday, January 20, 2014

// // Leave a Comment

Feeling Great - Thanks once again

Friends,
I have started this blog just for making fun. I was not serious about blogging and even unaware also. In the early days of my internet journy, I created lots of Free websites provided by most of companies and with their own subdomains. When GeoCites (Yahoo's free hosting service) was about to shut down, I have started to search alternative. I came to know about Blogger and registered a blog named pyarb.blogspot.com. I have just posted some funny posts, you can still see in Archieves on starting days.
On 11th July 2012, I received 10,000 visitors for my blog. During this span, I have learned a lot and registered my own domain also. But I was still using Free hosting and gpEasy, WordPress, Joomla or some other PHP based cms to post blogs. When there was some problem with web hosting provider, blog becomes unavailable and I feel very frustrated. Then I continued writing my posts here. Most of posts with other CMS has been lost so this is somehow empty. One best thing about Blogger is it is Free and always up. Also being a Google product it is easy to share and make available to web.
Some milestones.

Received 10K visitors on July 2012.
Now we are about to get 50K visitors.

I was earlier using blog.johnbhatt.com as url of website. Then I switched it to www.prithviraj.com.np which was somehow not confortable for search engine and visitors also. Then I registered a domain name www.pyarb.com and copied all blogs in one place. Then the most difficult task was to redirect all users and all existing link to new domain in case of blogger where we don't have access to .htaccess file. Then I found a method to Redirect user to new domain from older domain and now all existing links and bookmarks are also working fine.

I am very thankful to each and every visitor who have been through this website. Please provide your feedback and suggestions. This will help me on further improvement.
+John Bhatt 
Read More

Thursday, January 16, 2014

// // 1 comment

Export to Word from GridView in ASP.NET

Hi,

Today, I am going to continue our GridView tricks series ahead and posting a nice and useful feature. For all list of GridView articles we have written here, you can search for GridView in search box. As I have previously written about Exporting data to Excel from GridView, this is about exporting GridView to Microsoft Word which is another most used document format and needed in most cases.
Lets create a design as below.
I have just dragged and dropped a gridview control and used autoformat to make GridView look some better. 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .auto-style1 {
            text-align: justify;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <h1 class="auto-style1">
        Export to Word 
    </h1>
        <asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Width="590px">
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <RowStyle ForeColor="#000066" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#007DBB" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#00547E" />
        </asp:GridView>
        <br />
        <asp:Button ID="Button1" runat="server" Font-Bold="True" OnClick="Button1_Click" Text="Export to Word" />
    </div>
    </form>
</body>
</html>

Now bind data to this gridview from backend.

 protected void Page_Load(object sender, EventArgs e)
    {
        string ConString = "Server=.\\sqldb;database=Store;integrated security=true;";
        SqlConnection con = new SqlConnection(ConString);
        string QueryText = "SELECT DISTINCT Products.ProductName, Brands.BrandName, Category.CategoryName, 
Products.UnitPrice, Products.UnitsInStock from products,brands,Suppliers,Category 
where Products.BrandID=Brands.BrandID and Products.CategoryID=Category.CategoryID;";

        SqlDataAdapter adp = new SqlDataAdapter(QueryText, con);
        DataTable dt = new DataTable();
        adp.Fill(dt);
        GridView1.DataSource = dt.DefaultView;
        GridView1.DataBind();
    }
Let's view page in Browser. You must see data from your database. Mine query has resulted below data in grid.
Perfect, now its time to do the important stuff. Lets write code for Export Button. Double click in button to create a method and automatically bind event with control. Now write below code in backend.

 public override void VerifyRenderingInServerForm(Control control)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Clear();
        Response.Buffer = true;
        Response.AddHeader("content-disposition", string.Format("attachment;filename=Products.doc"));        
        Response.ContentType = "application/vnd.ms-word ";
        StringWriter WriterForWord = new StringWriter();
        HtmlTextWriter HTMLWriter = new HtmlTextWriter(WriterForWord);
        GridView1.AllowPaging = false;
        GridView1.DataBind();
        GridView1.RenderControl(HTMLWriter);
        Response.Output.Write(WriterForWord.ToString());
        Response.Flush();
        Response.End();
    }

Its time to check our code, Click on Export to Word button. I have attached snapshot of Firefox because it prompts user.
You can save file or just click on Open with your word processor software. I am using Microsoft Word here.
Did you read our previous Export to Excel tutorial? What are the similarities between exporting to Word and Excel?
I am leaving with a question, if you know, leave a reply below.
Thanks for reading . Do not forget to say thanks or plus1 or provide feedback.
+John Bhatt 
Read More

Friday, January 3, 2014

// // Leave a Comment

New project for Indian Computer Institute (ICI)

Hi,

These days I am working on a website and web application for Computer Institute.

Indian Computer Institute is a complete software training center established in 2008 and served more than 5000 students with excellent placement records. This institute is based in Rani Bagh location of New Delhi and some months ago, on the expansion of its chain of branch, a new Center has been opened at Jahangirpuri in New Delhi.

Project Details:

  • Website

    • Powered by PHP/MySQL platform.
    • WordPress as CMS.
    • Responsive Design.
  • Email

    • Email Service for their custom company.
    • Administration of services.
  • Software

    • Version 1.0.30 of ESKOOL, A complete web based Educational Institute Management system designed for Schools, training center and computer institutes based on ASP.NET platform.
Please have a look at my recent work and provide feedback or suggestions.

Read More

Wednesday, January 1, 2014

// // Leave a Comment

Creating a Static Home Page on Blogger

Hi,

On the first day of English Calender, lets start with Blogger tip. A lot of us use Blogger as blogging platform. Blogger is self hosted blogging software from Google. It has great tools and uptime and easier interface with lots of Google features integration with custom templates.
But it lacks a feature, you can not set a static home page. In other CMS (Content Management Systems) you have option to set your desired page as homepage so that each-time user visits website, the static welcome page or home page can be served. Blogger does not support this kind of setting.

Lets make a trick with Google so that we can set our desired post as home page.

Procedure:


  1. Sign into blogger account and choose blog for which you want to set a static homepage.
  2. If you have already written that post and published, skip options 3.
  3. Click on New Post button in your Blog Admin section.
  4. After setting your content and page title, Click on Schedule link in right side of compose box.
  5. Set any future date and save. Remember date must be of future, suggested is a year or more future. 

Logic

The above trick will work on blogger because blogs are sorted according to published date and newer first. So blogger will think that that blog is published in last time and display at top of your blog.

There might be some risk if you are using AdSense with blogger, because the AdSense team randomly checks websites and this might not be according to their policy.

Thanks for reading. Wish you a happy new year once again and better luck ahead.
Read More

Tuesday, December 31, 2013

// // Leave a Comment

Happy New Year 2014

Hi,

Wishing you and your family a very very happy and prosperous new year 2014.


Read More

Monday, December 16, 2013

// // Leave a Comment

Conversion Tool for all Number System

Hi,

If you are student of computer science, you must have required this feature sometime. You have to study and make calculation on different number systems. Mostly on Binary, Octal or Hexadecimal and Decimal number system are most used in Computer programming language.
We have collected and uploaded a application to help you. This will calculate the number of your choice to another system and also describe how this happened and actual answers.

As you can see in above snapshot, we tried to convert Decimal Number 100 to Binary number system (that is Base: 2). Answer is 1100100 but we have "Explain Answer" button, which explained the each and every step.

Go to Number Conversion Tool.

All the Best.
+John Bhatt 
Read More

Thursday, November 14, 2013

// // Leave a Comment

Custom WordPress Admin Style

Hello,

If you are a blogger, you must be using WordPress. WordPress is a blogging platform which is widely used a CMS and most used CMS by worlds developers which is downloaded by uncountable times. Latest version of WordPress is 3.7 which is release on Oct 24 2013. As on 28 Oct 11.50 PM IST, it has been downloaded 1.6 Million times.

Definitely, I am not here to define or describe WordPress. We all have used WordPress and its Admin Interface also. Which allows us to change Themes for WordPress created website and many such functionality. But we are going to change Administration Theme without any Theme. We will use a simple Plugin created by the creator of WordPress Matt Mullenberg.

By default It has Admin Theme like below snapshot.

Now search for a plugin in WordPress plugin directory named MP6. For your convenience link for MP6 plugin is http://wordpress.org/plugins/mp6/.
Download and Install MP6 in your wordpress installation. How above page looked after installing MP6 is below.
 Admin Dashboard
Add  New Post 
I just found it very nice and wanted to share with you. I am not affiliated with WordPress in anyway commercially. However I use it and love its feature as Blog engine.

You can add me on +John Bhatt and follow our page at P.Yar.B Complex at Google+

Tags: WordPress, personalize, admin, configuration, plugin, admin-theme 
Read More

Monday, October 28, 2013

// // Leave a Comment

GridView with Scrollbars

Hi,

Today I am here to share something to you. This is simpler as never but I bet, you are searching for this since long.

If you have developed any web application using ASP.NET, you must have used GridView, if you are beginner and learning ASP.NET, this will tell you how to make GridView scrollable. As we know, we can Paginate data in GridView, but putting a Scrollbar is really confusing as it is not in default properties of GridView control.

Lets design a web form and insert a GridView. I am using no designs and just a form and dragged and auto formatted GridView control in this tutorial.

Lets see the code for this web form.
 <div align="center">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="DistID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" Height="240px" Width="667px">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="DistID" HeaderText="DistID" InsertVisible="False" ReadOnly="True" SortExpression="DistID" />
                <asp:BoundField DataField="StateID" HeaderText="StateID" SortExpression="StateID" />
                <asp:BoundField DataField="DistName" HeaderText="DistName" SortExpression="DistName" />
                <asp:BoundField DataField="DistDesc" HeaderText="DistDesc" SortExpression="DistDesc" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>" SelectCommand="SELECT * FROM [Districts]"></asp:SqlDataSource>
    </div>

I have bind data from one of my projects, this is schema of Address and table is District List. Lets run the Web form, our output is:

This is how it will list record and entire page will have GridView data. To fix this, I have added just a style tag to Div and some code inside that tag. Below is code.
..style="height:400px; overflow:auto"..
//You can change overflow:auto to overflow:scroll but that will show both Scrollbar and always. Above will show Vertical Scrollbar only when the Height of GridView exceeds than assigned height.

After adding above code, I refreshed the browser, Now this is the new and required layout of GridView.

You can download the source code from JohnBhatt.com for free.
Enjoy. Till then subscribe our feeds and get updated. You can also drop a comment below to suggest us improving. 
Read More

Sunday, September 29, 2013

// // Leave a Comment

Redirect User to same Location on Different Domain

Hi,

Recently, I have changed my Blog address. Due to this, I have to face a lot of Traffic Loss.

My situation was, I have a Blogger blog and a domain. A lot of Links have been shared and If I change the Blog address and create a Permanent Redirect by changing DNS, but existing Bookmarks and Shared Links will not load properly. So, I kept the Existing Domain running and created a New Blog. Exported Template and Blog, Uploaded both to New Domain and just keep both domain running up. Now I have to redirect all visitors to Previous Domain to New Domain.


Here I came with a solution.

I have created a Simple JavaScript function.

<script>
    function redirect()
    {
    //You change your Domain name just in place of "http://www.pyarb.com".
    
  window.location = "http://www.pyarb.com/" + window.location.pathname;
    }
</script>

Description:

1. windows.location - This will set the Location of Window (i.e. Address of Browser.)
2. "http://www.pyarb.com" - This is your New Domain. Where you have kept all File structure same. Means Links are same for All files except Domain Name.
3. windows.location.pathname - This will get the Path of Window Location (i.e. Address of Browser except Domain Name.)

Then Executed this function on PageLoad event.

......
.......
</head>
<body onload="redirect();">
.........
.........

That's It. Your location remains same.

Enjoy,
+John Bhatt 
Read More

Thursday, September 26, 2013

// // Leave a Comment

Blogger Comment Box Updated

Hi,

This is a good news for all blogger. Google has recently updated its default Comment box in Blogger website. As we know, many of blogger are still using Bloggers Templates (I mean not using Custom Templates) and are annoyed of Older Comment Box.

This is for those bloggers who are not using Google+ comment system.


This Comment  Box had no option to Preview your comment body. Neither to get Notified when someone responds to your Comment.

But now, Google has updated Bloggers comment box to a new and beautiful layout. If you are logged In, you can click on the Button Notify. Means when someone responds to your Comment, you can get a message in your mailbox.

If you are logged Out and want to comment, your Profile selection screen will be also modified.


So, Enjoy.

Till then, you can add me on Circle at +John Bhatt 
Read More