By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,561 Members | 3,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,561 IT Pros & Developers. It's quick & easy.

Gridview not refreshing!

P: n/a
I have a GridView in a FormView that has as its datasource a DataTable
that is stored in the session cache.
When I first load the page the GridView is displayed correctly, but on
subsequent loads the GridView does not display. I've debugged the
DataTable and even when it has data and is bound to the GridView, when
the page loads the GridView is not displayed. I set the datasource and
then bind the GridView. I've tried disabling the ViewState for the
GridView but to no avail.
I'm at a loss to understand why the GridView is not displaying! I
suspect its due to the FormView but can't prove anything yet. Any
ideas?
Thanks for reading.

Oct 4 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
To give you some more details - the user clicks on a row in a gridview
called GrdVwLabelsSearchResults and then the method
DisplayLabelDetails() is called, which calls
BindSignatoryAndCCGridViews() to update the gridview GrdVwLabelContacts
on the FormView.
The datasource for GrdVwLabelContacts is a DataTable which is kept in
the Session Cache because rows can be added and removed from this
GridView.

protected new void Page_Load(object sender, EventArgs e)
{
//To trap a click event on the GrdVwLabelsSearchResults
gridview
string controlName = Request.Params.Get("__EVENTTARGET");
string passedArgument =
Request.Params.Get("__EVENTARGUMENT");

//check to see if the passedArgument was from the
GrdVwUsersSearchResults
//Get the labelID of the selected row and then
//display label details
if (controlName == "GrdVwLabelsSearchResults" &&
passedArgument.StartsWith("RowClicked"))
{
string labelID = passedArgument.Substring(10);
DisplayLabelDetails(labelID);
}

}

protected void DisplayLabelDetails(string labelid)
{
//change FormView to Edit Mode
FrmVwLabel.ChangeMode(FormViewMode.Edit);

//bind the Label Signatory and Contact Gridviews
BindSignatoryAndCCGridViews(labelid);
PnlLabelDetails.Visible = true;
FrmVwLabel.Visible = true;
}

protected void BindSignatoryAndCCGridViews(string labelStr)
{

DataTable labelCCDT = new DataTable();
if (CacheSession.GetLabelCCDT() == null)
{
labelCCDT = LabelManager.GetContactsForLabel(labelId,
contactRoleId);
CacheSession.SetLabelCCDT(labelCCDT);
}
else
{
labelCCDT = CacheSession.GetLabelCCDT();
}
GridView grdVwLabelCC =
(GridView)FrmVwLabel.FindControl("GrdVwLabelContac ts");
grdVwLabelCC.DataSource = labelCCDT;
grdVwLabelCC.DataBind(); //<----- this is not updating the GridView
correctly
grdVwLabelCC.Visible = true;
}

jo*********@gmail.com wrote:
I have a GridView in a FormView that has as its datasource a DataTable
that is stored in the session cache.
When I first load the page the GridView is displayed correctly, but on
subsequent loads the GridView does not display. I've debugged the
DataTable and even when it has data and is bound to the GridView, when
the page loads the GridView is not displayed. I set the datasource and
then bind the GridView. I've tried disabling the ViewState for the
GridView but to no avail.
I'm at a loss to understand why the GridView is not displaying! I
suspect its due to the FormView but can't prove anything yet. Any
ideas?
Thanks for reading.
Oct 4 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.