Thursday, December 30, 2010

How to use Telrik Red Ajax Loading Panel in asp.net

Hi ,
RadAjaxLoadingPanel is really very nice control provided by Telrik .
When Ajax using on any application then the application partially post back on sever. User does not have any notification about that . So telrik RadAjaxLoadingPanel being helpful for this .
How to use
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ddlCountry">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ddlCountry" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
         <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ddlCity">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ddlCity" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="5">
        <table style="width: 100%; height: 100%;">
            <tr style="height: 100%">
                <td align="center" valign="middle" style="width: 100%">
                    <asp:Image ID="Image2" ImageUrl="~/Images/loading5.gif" BorderWidth="0px" Height="32px"
                        Width="32px" AlternateText="Processing Data ...." runat="server"></asp:Image></td>
            </tr>
        </table>
    </telerik:RadAjaxLoadingPanel>
In rad ajax manager give the id of  DefaultLoadingPanelID="RadAjaxLoadingPanel1" 
 In <telerik:AjaxUpdatedControl ControlID="ddlCountry" LoadingPanelID="RadAjaxLoadingPanel1" /> give the id of the control which have to be postback. and Loding panel id of loding panel.

Note--> IF you face any problem you can search all the Document related to telrik control demo.
Thanks

Monday, December 13, 2010

Some Important Css syntax;

-moz-transform: rotate(-90deg) --> Using for transform the test vertical(Rotate the test 90 degree from there current position.
-webkit-transform: rotate(90deg)--> same as -moz-transform: rotate(-90deg)

-moz-border-radius: 15px--> Using for border desing.

Sunday, December 5, 2010

Google maps Api key for Local Host

ABQIAAAAygAR3fwEVNKNcBiM9PXxHBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQ4BAF8gRnAH-jczRjX-JJP33mTUg

Tuesday, November 23, 2010

Ajax with asp.net

Hi,
Here i am post the code how to use the ajax in asp.net (.aspx page).
This is the simple example of using ajax in .aspx page.

what is ajax
The core idea behind AJAX is to make the communication with the server asynchronous, so that data is transferred and processed in the background. As a result the user can continue working on the other parts of the page without interruption. In an AJAX-enabled application only the relevant page elements are updated and only when necessary.

In contrast, the traditional synchronous (postback-based) communication requires a full page reload each time data is transferred to/from the server.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>




<body>
    <form id="form1" runat="server">
 <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>
        <asp:UpdatePanel runat="server">
       <ContentTemplate>
    <asp:Label ID="lbl" runat="server" ></asp:Label>
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
            </ContentTemplate>
            <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnsubmit" EventName="Click" />
            </Triggers>
             </asp:UpdatePanel>
             <asp:Button ID="btnsubmit" runat="server" Text="button" OnClick="btnsubmit_Click"
            ValidationGroup="grp" />
       </form>
    </body>
   

</html>
 Just use the control under the update panel which is use on the current page.
u can call ajex on button submit event by the bind with <asp:AsyncPostBackTrigger> in which u can give controlid=(id of button) and event=(any event like on mouse over,click.....).


Jquery ajax wid asp.net

<head runat="server">
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        $().ready(function () {
            $('#btn').click(function () {
                $.ajax({
                    type: "POST",
                    contentType: "charset=utf-8",
                    url: "Ajax.aspx",
                    dataType: "json",
                    success: function (data) {
                        $('#txtBox').val("Zeeshan");
                        alert("deepak");
                        $('#txtname').val("deepak")

                    },
                    error: function (data) {
                    }

                });
            });
        });

    </script>
   
</head>
Firstly added the js library in the header session of the page.
$().ready(function () = Its denote the current document is ready to load.
$('#btn').click(function ()= Here

Thanks

Monday, November 22, 2010

Beginner: Cross browser compatibility

Beginner: Cross browser compatibility: "Most important issue in developing web site is cross browser supporting facility.Means o/p of one page is looking different in some browser ..."

Sunday, November 21, 2010

Jqurey file uploding without using server side control.

Hi guys,
for using file uploading control in your site just pick up this code and try to find out the solution.
It's work in a nice way.
Thank's.

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


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
        <title>ColdFusion And AJAX File Upload Demo</title>
     
     <!-- Linked scripts. -->
     <script type="text/javascript" src="jquery-1.2.2.pack.js"></script>
     <script type="text/javascript" src="ajax_upload.js"></script>
     <script>
      $(
 function(){

 var jForm = $( "form:first" );
 
 jForm.submit(
 function( objEvent ){
 var jThis = $( this ); 
 var strName = ("uploader" + (new Date()).getTime());
 
 var jFrame = $( "<iframe name=\"" + strName + "\" src=\"about:blank\" />" );
 
 jFrame.css( "display", "none" );
 
 jFrame.load(
 function( objEvent ){
 var objUploadBody = window.frames[ strName ].document.getElementsByTagName( "body" )[ 0 ];
 
 var jBody = $( objUploadBody );
 
 var objData = eval( "(" + jBody.html() + ")" );
 
 prompt( "Return Data:", objData );
 
 setTimeout(
 function(){
 jFrame.remove();
 },
 100
 );
 }
 );
   
 $( "body:first" ).append( jFrame );
 
 jThis
 .attr( "action", "upload_act.cfm" )
 .attr( "method", "post" )
 .attr( "enctype", "multipart/form-data" )
 .attr( "encoding", "multipart/form-data" )
 .attr( "target", strName )
 ;
 }
 );
 }
 );
 <cfset arrFiles = [] />
  <cfloop
 index="strFileIndex"
 from="1"
 to="10"
 step="1">


 <cfset strField = "upload#strFileIndex#" />
  <cfif (
 StructKeyExists( FORM, strField ) AND
 Len( FORM[ strField ] )
 )>
 
 <!--- Upload file. --->
 <cffile
 action="upload"
 filefield="#strField#"
 destination="#ExpandPath( '~/resume/' )#"
 nameconflict="makeunique"
 />
  <cfset ArrayAppend( arrFiles, CFFILE.ServerFile ) />
 
 </cfif>
 
 </cfloop>
 </script>

    </head>
     <body>
     
     <form>
     
     
     <input type="file" name="upload1" size="60" /><br />
     <br />
     
     <input type="file" name="upload2" size="60" /><br />
     <br />
     
     <input type="submit" value="Upload Files" />
     
     </form>
     
     </body>
</html>

Monday, November 15, 2010

How row indexing is possible in asp.net grid view.

<asp:GridView>
                                                <Columns>
                                                    <asp:TemplateField headertext="s.no">
                                                        <ItemTemplate>
                                                            <%# Container.DataItemIndex + 1 %>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
</grid view>

<%=txtUserName.ClientID%>.value 

Friday, November 12, 2010

Reset the text box text in masterpage and jquery

  1. <script>   
  2.     $(document).ready(function() {  
  3.       $('[id$=lnkBtn]').click(function() {  
  4.         $('[id$=TextBox1]').val("");  
  5.         return false;  
  6.       });  
  7.     });     
  8. </script>  
Another example of reset textbox is

<asp:Content ID="cntHeader" ContentPlaceHolderID="head" runat="Server">
<script type="text/javascript" src="../Scripts/jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {
        $('[id$=lnkCancel]').click(function () {
            $('[id$=txtFirstName]').val('');
            $('[id$=txtLastname]').val('');
            $('[id$=txtEmail]').val('');
            $('[id$=txtPhone]').val('');
        });

    });

Reset the dropdownlist
$('select[id$=\'DropdownlistID\']').val(-1);



    Thursday, October 28, 2010

    GAC( Global assambly cache)

    Hi guys,
    When we develop any application  By .net technology You just see the
    Using System name space. Did you think from where its come without reference any dll as add reference.
    Actually all the main name-space which is required in every project reside under the GAC(Global assembly cache).
               Now the question is arises from where the gac is coming..................
    Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.
    Gac is reside under the c://window//assembly(all the usefull dll file reside under this folder)

    Monday, October 25, 2010

    Linq for Beginner

    Language Integrated Query,  is a set of Microsoft .NET Framework language enhancements and libraries
    built by Microsoft to make working with data ex Access record from Table by using object.
    Example:
    List<Contact> contacts = Contact.SampleData();
    // perform the LINQ query            line 2
    var query = from c in contacts
                      orderby c.State, c.LastName
                            group c by c.State;
    // write out the results
    foreach (var group in query)
    {
    Console.WriteLine(”State: “ + group.Key);
    foreach (Contact c in group)
    Console.WriteLine(” {0} {1}”,
    c.FirstName, c.LastName);
    }
     Here in example line 2 we can easily find out how Database table use as a object.
    from c in contracts here contracts is a list which contain lot of record we are assemble all the record in variable c.  means here c is used as a Object which contain the table data. c.state show the data field in contact list.( In linq all the quarry Write down  just opposite to sql. The same quarey write down in sql as.
    select state,lastname from contract
    order by state group by LastName.

     LINQ to Objects allows .NET developers to write “queries” over collections of objects.working with collections of objects meant writing a lot of looping code using for loops or foreach loops.
     As simple example
    int[] nums = new int[] { 0, 4, 2, 6, 3, 8, 3, 1 };
    var result = from n in nums
    where n < 5
    orderby n
    select n;
    foreach (int i in result)
    Console.WriteLine(i);
    Output 2-3
    0
    1
    2
    3
    3
    4
    Listing

    Note----> Select-From-Where-OrderBy,(we follow this format when using SQL!!!!!!
                     From-Where-OrderBy-Select,(Just reverse in LINQ)



    Query joins two collections
    List<Contact> contacts = Contact.SampleData();
    List<CallLog> callLog = CallLog.SampleData();
    var q = from call in callLog
    join contact in contacts on
    call.Number equals contact.Phone
    select new {
    contact.FirstName,
    contact.LastName,
    call.When,
    call.Duration
    };
    foreach (var c in q)
    Console.WriteLine(
    ”{0} – {1} {2} ({3}min)”,
    c.When.ToString(”ddMMM HH:m”), c.FirstName,
    c.LastName, c.Duration);
    Output 2-7
    07Aug 08:
    Here we are fetch all record from Table contacts and callLog(In which phone no field is common on behalf of this we are join both table and fetch data according to our requirement.

     List<Contact> contacts = Contact.SampleData();
    List<CallLog> callLog = CallLog.SampleData();
    var q = from call in callLog
    where call.Incoming == true
    group call by call.Number into g
    join contact in contacts on
    g.Key equals contact.Phone
    orderby contact.LastName, contact.FirstName 

    The Let keyword:
    The let keyword enables you to keep the result of an expression
    (a value or a subquery) in scope throughout the rest of the query expression
    being written. Example
    int [] values=new int []  {2,4,5,6,76,5};
    var query = from i in values
            let doublei = 2 * i
            select doublei;
            Console.WriteLine(query);

    The new form of Linq

    List<Contact> contacts = Contact.SampleData();
    var q = contacts.Where(c => c.State == ”WA”)
    .OrderBy(c => c.LastName)
    .ThenBy(c => c.FirstName);
    foreach (Contact c in q)
    Console.WriteLine(”{0} {1}”,
    c.FirstName, c.LastName);

    The simple form Linq as i am thinking

    List<Contract> contacts= Contract.SampleData();  (here sample data just collect the ample data)
    var q= from con in contacts
               where con.state=='wa'
                orderby con.LastName
                select con;
    Cosole.WriteLine(q);
    The simple example how Linq work with sql joining  
                        
    List<Contact> contacts = Contact.SampleData();
    List<CallLog> callLog = CallLog.SampleData();
    var q = (from call in callLog
    join contact in contacts on
    call.Number equals contact.Phone
    orderby call.When descending
    select new
    {
    contact.FirstName,
    contact.LastName,
    call.When,
    call.Duration
    }).Take(5);
    foreach (var call in q)
    Console.WriteLine(”{0} - {1} {2} ({3}min)”,
    call.When.ToString(”ddMMM HH:m”),
    call.FirstName, call.LastName, call.Duration);

    Where Filter Using a Lambda Expression
    All lambda expressions use the lambda operator =>, which is read as "goes to".
    use this link  http://msdn.microsoft.com/en-us/library/bb397687.aspx

    string[] animals = new string[] { ”Koala”, ”Kangaroo”,“Spider”, “Wombat”, “Snake”, “Emu”};
    var q = animals.Where(
                                           a => a.StartsWith(“S”) && a.Length > 5);
    foreach (string s in q)

    {
    Console.WriteLine(s);

    }
    here a=> a.StartWith  show d lambda experison.

    string[] animals = new string[] {"Koala", "Kangaroo" };
    var q = from a in animal where a.StartsWith("K") && a.Length > select a;
    foreach (string s in q)
    Console.WriteLine(s);
    New form of linq(use function calling)

    string[] animals = new string[] { ”Koala”, ”Kangaroo”,
    ”Spider”, “Wombat”, “Snake”, “Emu”, “Shark” };
    var q = from a in animals
    where IsAnimalDeadly(a)   // in where clause call the function//
    select a;
    foreach (string s in q)
    Console.WriteLine(“A {0} can be deadly.”, s);

    public static bool IsAnimalDeadly(string s)  //Here define the Method
    {
    string[] deadly = new string[] {“Spider”, “Snake”,
    ”Shark”, “Sting-Ray”, “Jellyfish”};
    return deadly.Contains(s);
    }
    Output
    A Spider can be deadly.
    A Snake can be deadly.
    A Shark can be deadly.
    A Sting-Ray can be deadly.
    A Jellyfish can be deadly.

    Filtering by Index Position
    The
    zero-based index position can be passed into a lambda expression predicate
    by assigning a variable name as the second argument.
    To surface the index position, a lambda expression
    must be used, and this can only be achieved using the extension method
    syntax.
    Example of Index position

    string[] animals = new string[] { "Koala", "Kangaroo",
    "Spider", "Wombat", "Snake", "Emu", "Shark",
    "Sting-Ray", "Jellyfish" };
    var q = animals.Where((a, index) => index % 2 == 0);
    foreach (string s in q)
    Console.WriteLine(s);




    Monday, October 4, 2010

    Cross browser compatibility

    Most important issue in developing web site is cross browser supporting facility.Means o/p of one page is looking different in some browser like mozila,IE7,IE8 crome,safari etc.
    so developers test the web pages on different browser and create the different css file as per requirement and including in their page as example...........
    <head id="head1" runat="server">
      
        <!--[if IE 8]><!-->
        <link href="../Styles/IE8.css" rel="Stylesheet" type="text/css" />
        <!--<![endif]-->

        <meta HTTP-equiv="content-type" content="text/ht-ml; char-set=utf-8" />
        <link h ref=' http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:light,regular'
            rel='style sheet' type='text/css'>
    </head>
    This css only working in IE 8(internet explorer 8) and same as create many css file like
    IE7.CSS,   MOZ.CSS,  CROME.CSS.

    NOTE---> One Thing i am notice today is that IIS(Internet Information Server) store the web page changes so on account of this it show the previous  page so avoid these think programmer have to delete the browsing history of all the web browser which are using for testing and also reset the setting of Browser. 
    Thanks