We provide IT Services

Register Now Click On

Read More Tutorials Click On

Post Page Advertisement [Top]

What is IsPostBack and why use IsPostBack

IsPostBack is a property and its not a technique. and  returns the boolean value and Is Postback is normally used on page _load even and It is check  whether the page is IsPostBack  or not IsPostBack .



C# source code-

Syntax-
             protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //generate code
            }
          else
          {
             //Process data//
           }
        }

Difference between Ispostback and Autopostback in asp net 

1.   Ispostback- is initiated by browser and whole page reload .

2.Autopostback- is can be used to some control , you choose change if changing the control. 

for Ex- when we selected value of a dropdown changes


Controls that support AutoPostback-
  1. CheckBoxList
  2. ListControl
  3. RadioButtonList
  4. List item
  5. DropDownList
  6. ListBox
  7. CheckBox
           
Ex-
       <tr>
                    <td>Country:</td>
                    <td>
                        <asp:DropDownList ID="ddlcountry" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlcountry_SelectedIndexChanged"></asp:DropDownList></td>
                </tr>

No comments:

Post a Comment

| Designed by Rockprogrammer