Wednesday, March 21, 2012

How can I update a detailsview from a gridview in Atlas?

Hi, I have a gridview and a detailsview. The gridview takes a value from a textbox and retrieves rows. It has been atlas enabled and works fine. Now I want to take a value from the gridview and populate the detailsview. I have an asp:commandfield in my gridview for select, but everytime I click it is causes a postback. I don't want a postback (that's the whole reason for atlas). I don't believe I doing this correctly, my design. Also, all my detailsview "stuff" is in an updatepanel for atlas.

Any help is appreciated on how I can populate a detailsview based upon a gridview in atlas. Thanks.

Isn't this a common practice in non-atlas applications? Clicking a row in a gridview and populating a detailsview or formsview?

You need to set the Datakey on the gridview to the ID field of your datatable (hopefully you have one). Then set the datasource on the details view and configure the input parameter to be a control and pickup the Datakey from your gridview. This is a standard master detail setup, you can find good documentation on this in the VS 2005 documentation.(ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vwdcon/html/e3ab20ae-44c3-43f0-91f3-0f95fff47b48.htm).

I'm guessing the Atlas part of this is the fact your page is doing postbacks. So you need to put an updatepanel around the gridview and another around the detailsview? Then put a trigger on the detailsview updatepanel to point at the griview and the "SelectedIndexChanged" event.

Hope this helps


I am doubtful that the server side UpdatePanel control will provide what you are looking for. However, Atlas provides two client side controls ListView and ItemView which are exactly designed for your scenario.


Xiyuan Shen:

I am doubtful that the server side UpdatePanel control will provide what you are looking for. However, Atlas provides two client side controls ListView and ItemView which are exactly designed for your scenario.

Thank you. I will try it. But this does kind of get rid of my nice drag and drop abilities doesnt it?


you can bind a dragDropList behavior to the ListView and a dataSourceDropTarget to the ItemView to achive the DND

Xiyuan Shen:

you can bind a dragDropList behavior to the ListView and a dataSourceDropTarget to the ItemView to achive the DND

Sorry, I should have been clearer. I was referring to the drag and drop controls of Visual Studio 2005. I paid $800 for it. I don't like not being able to use it like the other controls. Hopefully, there will be a way to add drag and drop Atlas controls in the IDE's toolbox one day.


Checkout Scott Guthrie's video athttp://atlas.asp.net/Default.aspx?tabid=47

It's an excellent tutorial on getting started with Atlas. It combines GridView and Details View, with some filtering. You can also download for offline viewing.


petehbourne:

Checkout Scott Guthrie's video athttp://atlas.asp.net/Default.aspx?tabid=47

It's an excellent tutorial on getting started with Atlas. It combines GridView and Details View, with some filtering. You can also download for offline viewing.

I have watched it, but could not see where he selected a value in the gridview and populated a detailsview. He did it the other way around it looks like.


Hopehttp://forums.asp.net/thread/1247115.aspx can provide you some help

No comments:

Post a Comment