vijay

welcome Netizen

Share Your Knowledge.It is a way to achieve immortality

Friday, December 30, 2011

Invalid temp directory in chart handler configuration [c:\TempImageFiles\].


Hi..

Recently I used chart control in one of my project.when local its working perfectly.when I move to server it shows an error messageas show below…..

Invalid temp directory in chart handler configuration [c:\TempImageFiles\].
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.DirectoryNotFoundException: Invalid temp directory in chart handler configuration [c:\TempImageFiles\].

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below

To Resolve:

Then I replaced a particular line line in web.config file..
From this:
  <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />

To this one..
<add key="ChartImageHandler" value="storage=file;timeout=20;/>

Then the error will be resolved……..
I hope you find something useful.. 

Thursday, December 29, 2011

Preview image before upload using javascript in asp.net or preview image using fileupload control


Introduction:
Hi
Here I have share the code ..to preview the image before store into database.
Description:
This easy code to preview image before upload to database using file upload control. This code will work only IE 7 and IE 8 then firefox ,chrome…
Code:
<head id="Head1" runat="server">
    <title>Untitled Page</title>
       <meta http-equiv="X-UA-Compatible" content="IE=8"/>
        <script language="javascript" type="text/javascript">
        function PrevImg(imgFile) {
            var Preview = document.getElementById("Image1");
           Preview.src = imgFile.value;
            Preview.style.width = "200px";
            Preview.style.height = "150px";
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        preview
        <asp:FileUpload ID="Fud_Pic" runat="server" onchange="PrevImg(this)" />
       
        <asp:Image ID="Image1" runat="server" />
      
       
    </div>
  
    </form>
</body>

Sample preview:


i hope this helpfull to all

post your comments here.........

Tuesday, December 27, 2011

How to integrate Google map in asp.net? or Integration Google map in ASP.net Or API Google map


Introduction:
Here I will explain about, How to integrate the Google map in asp.net web site.
Description:
First for Google map integration you need to get the API key from Google website. In before there is no limit for generating API key per day for Google map. But now the Google introduced on October 1st some limitation for using Google map.
Also there is a limit of number of geocode usage per day..  Refer to the FAQ for details.
API KEY:
For getting an API key, Go to the below link enter your website URL and generate the API key..


Process:
There are number of procedure to integrate a google map in asp.net website, some of them are using dll to add a google map. But this methods is very easy method to integrate google map.
Here I used JavaScript methods to integrate on google map.
By using this code we can search the place using Country name or Postcode. i pass the country name form the server side code.


Code:
You have to mention the api key for your website

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=API KEY&sensor=false"
        type="text/javascript"></script>



Here the country name has passed from the server side in the variable name txtAddress from textbox




<script type="text/javascript">
           var map;
           var geocoder;
           function initialize() {
               if (GBrowserIsCompatible()) {
                   map = new GMap2(document.getElementById("map"));
                   map.setCenter(new GLatLng(51.5, -0.1), 10);
                   map.setUIToDefault();

                   geocoder = new GClientGeocoder();
                   showAddress();
            }
           }
           function showAddress() {
               var txtAddress = document.getElementById("<%=txtAddress.ClientID %>");
               var address = txtAddress.value;

               geocoder.getLatLng(
                address,
                function(point) {
                    if (!point) {
                        alert(address + " not found");
                    }
                    else {
                        map.setCenter(point, 15);
                        var marker = new GMarker(point);
                        map.addOverlay(marker);
                        marker.openInfoWindow(address);
                    }
                }
            );
           }
        </script>


In Body we have to add the JavaScript function in on bodyload.then we have to declare Div tag for showing google map. Code as follows.


<body onload="initialize()" onunload="GUnload()">
    <form id="form1" runat="server">
     <div>
            <asp:TextBox ID="txtAddress" runat="server" />                                            
            <input type="button" value="Find" onclick="showAddress();" />
        </div>
   
        <div id="map" style="width: 500px; height: 500px"></div>
</form>
</body>


Steps:
First enter country name in the textbox
Then click find button to show the country in the google map.
Now the map shows the exact point as mention place in the textbox.
Advantages:
By using this google map use option zoom in and zoom out.
Change the view of the map.
Move the place in the map.

I hope this one helpful to all…….

Post your valuable comments here...........

Monday, December 26, 2011

CSS for Ajax ValidatorCalloutExtender


Introduction:

Hi…Here I have to share the css code for ajax callout extender…

Description:

Intially you have to write this below css code and copy images to the seprate folder..

Code:

<asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" Enabled="True" CssClass ="customCalloutStyle" runat="server" TargetControlID ="RequiredFieldValidator1"  PopupPosition="Right" CloseImageUrl ="~/images/clo.png" WarningIconImageUrl ="~/images/war.png"  >
    </asp:ValidatorCalloutExtender>


CSS:
<style type="text/css">
.customCalloutStyle div, .customCalloutStyle td{
border: solid 1px Black;
background-color:#07888E;
color:White;
}
    </style>


Images



Sample image:

I hope this one helpful to all…….

Tuesday, December 20, 2011

Regular expression for India mobile number and landline number


Hi..
Here I share the regular expression code for India mobile number and landline number
For Mobile Number
^9\d{9}$

For Landline Number

^[0-9]\d{2,4}-\d{6,8}$

Friday, December 9, 2011

Microsoft .Net certifications or Microsoft exam or Microsoft certifications


Hi.


Recently I start to prepare to write for .net certification. So I collect the details about .net certification.


When I goggled I found heaps of links available. Now I want to share my knowledge about .net certification, how to prepare and from where to strat. Intially for a beginner programmer the right and apt exam is 70-536. Its Microsoft .NET Framework - Application Development Foundation.

Then Later try on 70-561 or 70-562 then only which gives firm grip on ADO.net
Also 70-536 exams is primary one for all other MCTS like Web or Windows certifications.
In the below links you can find the all information related to for .net certifications 70-536.


For training kit..


These exams will be conducted in prometric center at the scheduled time. Below the link about prometric center.


For register test site you can use below link for test sites for all city …



Regarding Syllabus/Objectives for 70-536 this link is very much useful : 


My suggestion would be don’t go with dumbs material. If you read by yourself you can gain 90% in the exam. There number of self placed training kit is available and heaps of book content available in web…

All the best those who are prepare for the exams….

Post your comments if they really helpful to you……

Thursday, December 8, 2011

Subscribe to YouTube AdSense account or create a new YouTube AdSense account:


Hi
Many of them don’t know to earn money from YouTube AdSense. For YouTube you can use same Google AdSense account..

Steps to follow:
Create your own videos it should be related to anything..Like teaching..or showing something interesting through your adventures, but important one videos should be created by yourself..If watching your videos for more than 10 seconds..Then YouTube started put the ad below in videos then your earning will be increased as eventually…
Most advantages even you can upload the videos from your mobile itself…it will be very easy one to show your creativity to others…
You already have an active AdSense account:
  1. Sign in to your YouTube account (Note: sign in on a separate browser if your YouTube login email address is different from your AdSense login).
  2. Click on the link in the notification box appearing on your homepage to complete your application.
  3. Go through the tutorial/guidelines.
  4. When asked to associate an AdSense account, enter your AdSense account information in the appropriate field.
  5. Accept the Terms of Service and confirm.
  6. Sign into your AdSense account. (Again, use a separate browser if your YouTube and AdSense login email addresses are not the same.)
  7. Allow YouTube to access your AdSense account. This is done under the "Home" tab, in the "Account settings" section and then under "3rd-party access
You don't have an active AdSense account yet:
  1. Sign in to your YouTube account.
  2. Click on the link in the notification box appearing on your homepage to complete your application.
  3. Go through the tutorial/guidelines.
  4. When asked to associate an AdSense account, select the option to create a new AdSense account.
  5. Fill in the application form and submit your application to AdSense for review. (Note: It typically takes 3 business days for your application to be reviewed.)
  6. Once your AdSense account is approved, sign into your YouTube account and accept the agreement.
You should receive an email from YouTube once the accounts have been linked successfully.

Wednesday, December 7, 2011

Show image as thmbnail using jquery in asp.net


Hi…
Everyone have to search to display an image in thumbnail..because its necessary to show in thumbnail. Otherwise image was shrink it’s not look good…
When I am surfing I found very easy, simple code to show image in thumbnail….so I share the code with my blog folks………


<html>
<head>
<style
type="text/css">
.thumbnail
{
vertical-align:middle;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script type="text/javascript">
function makethumb(src,FixedSize)
{var Width = $(src,this).width();
var Height = $(src,this).height();
var Ratio = Width / Height;
if (Width > FixedSize) {$(src,this).width(FixedSize)}
if (Height > FixedSize) {
var sizedwidth = FixedSize / Ratio;
var sizedheight = FixedSize / Ratio;
if (Height > Width) { if (Height > sizedwidth) {$(src,this).height = FixedSize}
if (sizedwidth > FixedSize) {$(src,this).width($(src,this).width() * Ratio);}
else {$(src,this).height($(src,this).height() * Ratio);}
}
else {$(src,this).width(FixedSize)}
}};
</script>
</head>
<body>
<img id="a1" class="thumbnail" src="http://latimesblogs.latimes.com/photos/uncategorized/2008/10/05/love.jpg" onload="makethumb(this,100)" />
<img id="a2" class="thumbnail" src="http://images.google.com.my/intl/en_ALL/images/images_hp.gif" onload="makethumb(this,100)"/>
</body>
</html>


i hope this one helpful to all........

Monday, December 5, 2011

Error: The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)

If you got this error then import namespace...Recently i got this error when i am doing project...

using System.Collections.Generic;


I hope someone need this one............

Connectionstring for MS access 2007 in ASP.NET


Hi...
Just I share the connection string for ms access 2007 in ASP.net..might be someone will search for the connection string for local system.
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\student.accdb;Persist Security Info=False;
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\student.mdb;Persist Security Info=False;";

Sunday, December 4, 2011

Update,edit and delete in grid view using C# code Or how to edit itemtemplate in gridview using c# code


Introduction:
Here I have write an  article about update,delete and edit in grdview using C# coding….Already I have written in vb code …For your reference I mention the link below…….

Description:
Below its fully an client side code…

   <div>
        <asp:GridView ID="GridView1" runat="server" Width="500px"
            AutoGenerateColumns ="false" AllowPaging ="true" GridLines ="Both"
            AlternatingRowStyle-BackColor ="AliceBlue"
            onrowcancelingedit="GridView1_RowCancelingEdit"
            onrowediting="GridView1_RowEditing" onrowupdating="GridView1_RowUpdating"
            DataKeyNames ="id" onrowdeleting="GridView1_RowDeleting">
        <Columns>
        <asp:TemplateField HeaderText ="student Name">
        <ItemTemplate >
        <%#Eval("Name") %>
              
        </ItemTemplate>
        <EditItemTemplate >
            <asp:TextBox ID="TextBox1" runat="server" Text=' <%#Eval("Name") %>' ></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText ="Address">
        <ItemTemplate >
        <%#Eval("address") %>
       
       
        </ItemTemplate>
        <EditItemTemplate >
            <asp:TextBox ID="TextBox2" runat="server" Text=' <%#Eval("address") %>' ></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText ="Gender">
        <ItemTemplate >
        <%#Eval("sex") %>
       
       
        </ItemTemplate>
        <EditItemTemplate >
            <asp:TextBox ID="TextBox3" runat="server" Text=' <%#Eval("sex") %>' ></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText ="Remarks">
        <ItemTemplate >
        <%#Eval("remarks") %>
       
       
        </ItemTemplate>
        <EditItemTemplate >
            <asp:TextBox ID="TextBox4" runat="server" Text=' <%#Eval("remarks") %>' ></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
        <asp:CommandField ShowEditButton ="true" />
        <asp:TemplateField HeaderText ="Delete" >
        <ItemTemplate >
                    <asp:Button ID="Button1" runat="server" Text="Delete" CommandName ="delete"/>

        </ItemTemplate>
        </asp:TemplateField>
        </Columns>
               
        </asp:GridView>
    </div>
Below is server side code…
protected void Page_Load(object sender, EventArgs e)
    {
       
        con.Open();

        Loadgr();
      
        con.Close();
   }

    void  Loadgr()
   {
       strold = "select * from stud";
       OleDbCommand oldcmd = new OleDbCommand(strold,con);
       OleDbDataAdapter oldda = new OleDbDataAdapter(oldcmd);
        DataSet ds=new DataSet();
       oldda.Fill(ds);
       GridView1.DataSource = ds;
       GridView1.DataBind();


}

    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox txt1;
        TextBox txt2;
        TextBox txt3;

        TextBox txt4;
        int id;
        id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
        txt1 = GridView1.Rows[GridView1.EditIndex].FindControl("textbox1") as TextBox;
        txt2 = GridView1.Rows[GridView1.EditIndex].FindControl("textbox2") as TextBox;
        txt3 = GridView1.Rows[GridView1.EditIndex].FindControl("textbox3") as TextBox;
        txt4 = GridView1.Rows[GridView1.EditIndex].FindControl("textbox4") as TextBox;

        //txt4=((TextBox )GridView1.FindControl("textbox1"));
        strold = "update stud set Name='" + txt1.Text + "',Address='" + txt2.Text + "',Sex='" + txt3.Text + "',Remarks='" + txt4.Text + "' where ID='" + id + "'";
        OleDbCommand oldcmd = new OleDbCommand(strold,con);
        con.Open();
        oldcmd .ExecuteNonQuery ();
        con.Close();
            Loadgr ();



    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;
        Loadgr();

    }
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        GridView1.EditIndex = -1;
        Loadgr();

    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int id;
        id = Convert.ToInt32(GridView1 .DataKeys [e.RowIndex ].Value );
        strold ="delete from stud where ID'" + id +"'";
        OleDbCommand oldcmd=new OleDbCommand (strold ,con);
        con.Close ();
        oldcmd.ExecuteNonQuery();

        con.Close ();
        Loadgr ();



    }
Post Your comments here………