What is IsPostBack and why use 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-
- CheckBoxList
- ListControl
- RadioButtonList
- List item
- DropDownList
- ListBox
- 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