469,902 Members | 2,035 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,902 developers. It's quick & easy.

Gridview not refreshing!

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
1 4987
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.

Similar topics

1 post views Thread by Loading name... | last post: by
reply views Thread by Steven Nagy | last post: by
reply views Thread by Don | last post: by
3 posts views Thread by COHENMARVIN | last post: by
5 posts views Thread by brian | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.