Hi, everybody! I have a problem when I load data to DataGrid. I have a web page and a RadFormDecorator, when I click a button in RadFormDecorator, I want data in RadFormDecorator will update to database and update in DataGrid. I call Response.Redirect("MyWeb.aspx") but DataGrid in MyWeb can't update. My code:
When I call Response.Redirect("MyWeb.aspx"), dataset changed but Radgrid not changed? Thanks!
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
SqlDataAdapter da =
new
SqlDataAdapter();
ds =
new
DataSet();
DataTable dt =
new
DataTable();
SqlConnection conn =
new
SqlConnection(connectionString);
SqlCommand cmd =
new
SqlCommand();
conn.Open();
try
{
cmd = conn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText =
"MyStored"
;
da.SelectCommand = cmd;
ds.Tables.Clear();
ds.Clear();
ds.AcceptChanges();
da.Fill(ds);
Session.Clear();
Session.Add(
"Source"
, ds);
radgrid.DataSource =
null
;
radgrid.DataSource = ds.Tables[0];
radgrid.DataBind();
}
catch
{
}
conn.Close();
}
}
When I call Response.Redirect("MyWeb.aspx"), dataset changed but Radgrid not changed? Thanks!