Results 1 to 2 of 2

Thread: AutoPostBack Property

  1. #1
    SmithJohnson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    364
    Rep Power
    3

    Default AutoPostBack Property

    C sharp: AutoPostBack Property

    Why we use "AutoPostBack Property" in C#. What is syntax for this property of C#? As C # is very difficult as compare to Java language. If you have any information about the AutoPostBack Property, then please inform me. Any help would be highly appreciated.Thanxs.

  2. #2
    Williamsjones is offline Senior Member
    Join Date
    Dec 2009
    Posts
    352
    Rep Power
    3

    Default

    It's the AutoPostBack property that really does all the magic here. Whenever a control loses focus, if the value of the control has changed, the page is automatically resubmitted (or posted back) to the server so the page can process the new values.

    Try to understand code given below which is helpful for you.

    <%@ Page Language="VB" %>
    <script language="VB" runat="server">
    Sub Page_Load(Sender As Object, E As EventArgs)
    ' Set the text of the label controls to reflect the
    ' values entered or selected in the form.
    If myCheckBox.Checked Then
    lblCheckBox.Text = "checked"
    Else
    lblCheckBox.Text = "did not check"
    End If
    lblTextBox.Text = myTextBox.Text
    lblDropDownList.Text = myDropDownList.SelectedItem.Value
    End Sub
    </script>
    <html>
    <head>
    <title>ASP.NET AutoPostBack Sample</title>
    </head>
    <body>
    <form runat="server">
    <asp:TextBox id="myTextBox" runat="server"
    AutoPostBack="True"
    />

    <aspropDownList id="myDropDownList" runat="server"
    AutoPostBack="True"
    >
    <asp:ListItem>Item 1</asp:ListItem>
    <asp:ListItem>Item 2</asp:ListItem>
    <asp:ListItem>Item 3</asp:ListItem>
    <asp:ListItem>Item 4</asp:ListItem>
    <asp:ListItem>Item 5</asp:ListItem>
    <asp:ListItem>Item 6</asp:ListItem>
    </aspropDownList>
    <asp:CheckBox id="myCheckBox" runat="server"
    AutoPostBack="True"
    />
    <p>
    You entered
    &quot;<asp:Label id="lblTextBox" runat="server" />&quot;
    in the text box, selected
    &quot;<asp:Label id="lblDropDownList" runat="server" />&quot;
    from the drop down list, and
    <asp:Label id="lblCheckBox" runat="server" />
    the checkbox.
    </p>
    </form>
    <hr />
    </body>
    </html>
    Last edited by nitesh14; 02-06-2010 at 04:08 PM.

Similar Threads

  1. Unable to set the Read only property on a folder
    By HallMiller in forum Windows Vista
    Replies: 1
    Last Post: 05-13-2010, 01:32 PM
  2. CSS property window
    By HowardAdams in forum Operating System
    Replies: 1
    Last Post: 01-29-2010, 05:24 PM
  3. C# for Invoking a Property
    By CarterBaker in forum Software Jargons
    Replies: 2
    Last Post: 01-20-2010, 05:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48