Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
6
Reply
how to use "IsPostBack" & ViewState in c# windows appli..
Jyoti Jodha
Apr 5 2017 3:54 AM
218
Reply
public Form2()
{
InitializeComponent();
if (
!this.IsPostBack
)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[2] { new DataColumn("Name"), new DataColumn("Country") });
ViewState
["Customers"] = dt;
this.BindGrid();
}
}
protected void BindGrid()
{
dataGridView.DataSource = (DataTable)
ViewState
["Customers"];
dataGridView.
DataBind
();
}
Error show in red highlight
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
6
)
Next Recommended Forum
in which scenario people use factory design patter.
How to get int math.random round number?