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

UpdatePanel and Gridview / DetailsView

P: n/a
I have a page with a LoginView which contains a Gridview and a
DetailsView, each in its own UpdatePanel

The problem that I am experiencing is that when I select a record in
the Gridview (using a SelectButton), the selected record is shown in
the DetailsView, which is correct - however, when I choose "Update" on
the DetailsView I am presented with the EditItemTemplate which
contains the first record in the DetailsDataSource.

The code that changes the selected record in the DetailsView is in the
GridView1.SelectedIndexChanged event as:

protected void GridView1_SelectedIndexChanged(object sender, EventArgs
e)
{
GridView gv1 =
(GridView)LoginView1.FindControl("GridView1");
DetailDataSource.FilterExpression = "ID='" +
gv1.SelectedValue.ToString()+"'";
}

Clicking the "Select" button on the GridView while the DetailsView is
in either "ReadOnly" or "Edit" modes loads the DetailsView with the
correct record - but switching views causes the record to go back to
the default (1st) record.

I am wondering if the update panels may be causing the problem -
should everything be in a single update panel?
It's my first time playing with the control so I'm not sure about all
of the intricacies with it yet.
Any help would be greatly appreciated.

Mike

Feb 16 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

quickly thinking it indeed sounds as if they should be in a single
updatepanel when change in other flows immediately to the another control
(otherwise you'd need to trigger updates for the panels). This is just
guessing, but try putting them into single UpdatePanel first.
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

<mi**@5starserv.comwrote in message
news:11**********************@t69g2000cwt.googlegr oups.com...
>I have a page with a LoginView which contains a Gridview and a
DetailsView, each in its own UpdatePanel

The problem that I am experiencing is that when I select a record in
the Gridview (using a SelectButton), the selected record is shown in
the DetailsView, which is correct - however, when I choose "Update" on
the DetailsView I am presented with the EditItemTemplate which
contains the first record in the DetailsDataSource.

The code that changes the selected record in the DetailsView is in the
GridView1.SelectedIndexChanged event as:

protected void GridView1_SelectedIndexChanged(object sender, EventArgs
e)
{
GridView gv1 =
(GridView)LoginView1.FindControl("GridView1");
DetailDataSource.FilterExpression = "ID='" +
gv1.SelectedValue.ToString()+"'";
}

Clicking the "Select" button on the GridView while the DetailsView is
in either "ReadOnly" or "Edit" modes loads the DetailsView with the
correct record - but switching views causes the record to go back to
the default (1st) record.

I am wondering if the update panels may be causing the problem -
should everything be in a single update panel?
It's my first time playing with the control so I'm not sure about all
of the intricacies with it yet.
Any help would be greatly appreciated.

Mike
Feb 16 '07 #2

P: n/a
Teemu,

Thanks for your help! I placed the controls inside a single
UpdatePanel and changed a couple of setting in the DataSources and I
have it working nicely. Thanks again!

Mike

On Feb 16, 2:09 pm, "Teemu Keiski" <jot...@aspalliance.comwrote:
Hi,

quickly thinking it indeed sounds as if they should be in a single
updatepanel when change in other flows immediately to the another control
(otherwise you'd need to trigger updates for the panels). This is just
guessing, but try putting them into single UpdatePanel first.

--
Teemu Keiski
AspInsider, ASP.NET MVPhttp://blogs.aspadvice.com/jotekehttp://teemukeiski.net

<m...@5starserv.comwrote in message

news:11**********************@t69g2000cwt.googlegr oups.com...
I have a page with a LoginView which contains a Gridview and a
DetailsView, each in its own UpdatePanel
The problem that I am experiencing is that when I select a record in
the Gridview (using a SelectButton), the selected record is shown in
the DetailsView, which is correct - however, when I choose "Update" on
the DetailsView I am presented with the EditItemTemplate which
contains the first record in the DetailsDataSource.
The code that changes the selected record in the DetailsView is in the
GridView1.SelectedIndexChanged event as:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs
e)
{
GridView gv1 =
(GridView)LoginView1.FindControl("GridView1");
DetailDataSource.FilterExpression = "ID='" +
gv1.SelectedValue.ToString()+"'";
}
Clicking the "Select" button on the GridView while the DetailsView is
in either "ReadOnly" or "Edit" modes loads the DetailsView with the
correct record - but switching views causes the record to go back to
the default (1st) record.
I am wondering if the update panels may be causing the problem -
should everything be in a single update panel?
It's my first time playing with the control so I'm not sure about all
of the intricacies with it yet.
Any help would be greatly appreciated.
Mike- Hide quoted text -

- Show quoted text -

Feb 17 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.