|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Save Child GridView only when parent GridView SavedI am adding Survey functionality to an application I am working on. There are
Question and each Question has multiple possible answers. I need to have a GridView display the Questions with a nested GridView that allows you to edit the Answers for each Question. Now, the tricky part is I need to make it so all rows in the nested Answer GridView are editable (allow insert/update/delete), but only save when you save the Question row of the parent GridView. It needs to allow the user to edit all data elements of the Question and save them all at once. The goal of using this for the UI is to make the editing/maintaining of the Surveys look just like a form for taking the survey. Does anyone have any suggestions of how to do this with the GridView control? Hello Crpietschmann,
I've also found another thread "Mixed Mode (Forms & Windows) Authentication" in the asp.net security newsgroup and have also posted some suggestion here. Regarding on the question you mentioned in this thread here are some of my understanding and ideas: As you said, the page will display multiple Questions and each of which contains multiple answer items, I think your decision on using nested template databound control is reasonable. However, instead of using GridView + GridView, I suggest you use Repeater + GridView(nested) because GridView is a very expensive one comparing to repeater (on performance consideration). If the inner answer list of each Question do not need to display multiple columns, you can even consider use DataList instead of GridView. So I think the better combination is repeater + DataList. Each question displayed through repeater items and use a DataList for displaying sub answer items. Datalist also support Edit,Update, Delete, insert events .... Display each main Question in repeater item is easy, the problem here is displaying the answer items through DataList or GridView in each RepeaterItem. Since you said that the answer list of each question support insert/edit/update, I'm wondering how the data will persisted in the database, this will impact how we will implement our code logic to manpulate the data associated with the DataList control in each Question Item(repeater item). For example, if in the database, you have a main table storing all the questions and another sub table which store answer items and each anwser item use a question ID to associate with its main question, then in our ASP.NET page, we could consider the following means to display and manipulate question data: ** use ADO.NET dataadapter or table adapter to query both the main table(questios) and sub table(answer items) as two DataTables and save them into Application's Cache storage since we'll manipulate them later. ** At page's first request, databind repeater through the main questions table and in each repeater item, you can use the "Repeater.ItemDataBound" event to get the sub answer list from Sub DataTable and bind the items to the nested DataList/GridView. ** When user perform insert, update, delete ... operation on the nested DataList/GridView control, we need to update the certain anwser record's value in the cached datatable(sub table). ** when the user want to save all the setting, just update the two cached datatable into backend database.... The above steps is a general description. It would be helpful, if you can provide me the detailed database structure and a screenshot of a prototype page which demonstrate how the questions and answers will display and let user to manipulate them. Thus, we can try looking into it further. If you have any question, please feel free to post here. Sincerely, Steven Cheng Microsoft MSDN Online Support Lead ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. I do have one question, Doesn't the Application Cache store stuff for use
across the entire application? I need to support multiple users editing multiple surveys at the same time, so wouldn't Session state be the best place to store the cached data until they would like to save it? I am using ObjectDataSource's with my own objects and collections to access the database. The solution you suggested sounds like it would work just fine for my application. Thanks for the suggestion! Show quoteHide quote "Steven Cheng[MSFT]" wrote: > Hello Crpietschmann, > > I've also found another thread "Mixed Mode (Forms & Windows) > Authentication" in the asp.net security newsgroup and have also posted some > suggestion here. > > Regarding on the question you mentioned in this thread here are some of my > understanding and ideas: > > As you said, the page will display multiple Questions and each of which > contains multiple answer items, I think your decision on using nested > template databound control is reasonable. However, instead of using > GridView + GridView, I suggest you use Repeater + GridView(nested) because > GridView is a very expensive one comparing to repeater (on performance > consideration). If the inner answer list of each Question do not need to > display multiple columns, you can even consider use DataList instead of > GridView. > > So I think the better combination is repeater + DataList. Each question > displayed through repeater items and use a DataList for displaying sub > answer items. Datalist also support Edit,Update, Delete, insert events .... > > Display each main Question in repeater item is easy, the problem here is > displaying the answer items through DataList or GridView in each > RepeaterItem. Since you said that the answer list of each question support > insert/edit/update, I'm wondering how the data will persisted in the > database, this will impact how we will implement our code logic to > manpulate the data associated with the DataList control in each Question > Item(repeater item). > > For example, if in the database, you have a main table storing all the > questions and another sub table which store answer items and each anwser > item use a question ID to associate with its main question, then in our > ASP.NET page, we could consider the following means to display and > manipulate question data: > > ** use ADO.NET dataadapter or table adapter to query both the main > table(questios) and sub table(answer items) as two DataTables and save them > into Application's Cache storage since we'll manipulate them later. > > ** At page's first request, databind repeater through the main questions > table and in each repeater item, you can use the "Repeater.ItemDataBound" > event to get the sub answer list from Sub DataTable and bind the items to > the nested DataList/GridView. > > ** When user perform insert, update, delete ... operation on the nested > DataList/GridView control, we need to update the certain anwser record's > value in the cached datatable(sub table). > > ** when the user want to save all the setting, just update the two cached > datatable into backend database.... > > The above steps is a general description. It would be helpful, if you can > provide me the detailed database structure and a screenshot of a prototype > page which demonstrate how the questions and answers will display and let > user to manipulate them. Thus, we can try looking into it further. > > If you have any question, please feel free to post here. > > Sincerely, > > Steven Cheng > > Microsoft MSDN Online Support Lead > > > > ================================================== > > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif > ications. > > > > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues > where an initial response from the community or a Microsoft Support > Engineer within 1 business day is acceptable. Please note that each follow > up response may take approximately 2 business days as the support > professional working with you may need further investigation to reach the > most efficient resolution. The offering is not appropriate for situations > that require urgent, real-time or phone-based interactions or complex > project analysis and dump analysis issues. Issues of this nature are best > handled working with a dedicated Microsoft Support Engineer by contacting > Microsoft Customer Support Services (CSS) at > http://msdn.microsoft.com/subscriptions/support/default.aspx. > > ================================================== > > > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > > Thanks for your reply Chris,
Yes, this is a good question. Actually I originally want to demonstrate it through SessionState, however, the problem is that SessionState does not support any cache dependency(to clean data up). That means any data we set into Cache need us to explicitly clear it while Application Cache support automatically cleanup(after certain time or other dependency). Also, you can add an identity into the Cache "key" when storeing per-user specific data into it, the identity could be sessionID or username .... Anyway, no matter we use sessionstate or Cache, it is recommended that we manually clean the data as soon as we've finished using it since they'll consume lots of server memory(especially when storing datatable/dataset....). If there is anything else you wonder, please feel free to let me know. Sincerely, Steven Cheng Microsoft MSDN Online Support Lead This posting is provided "AS IS" with no warranties, and confers no rights. Because of the time crunch I needed to just make the app work instead of
making the UI really nice. But, when I do get around to changing it to work smoother I'll definately implement what you've suggested. Thanks alot!! Show quoteHide quote "Steven Cheng[MSFT]" wrote: > Thanks for your reply Chris, > > Yes, this is a good question. Actually I originally want to demonstrate it > through SessionState, however, the problem is that SessionState does not > support any cache dependency(to clean data up). That means any data we set > into Cache need us to explicitly clear it while Application Cache support > automatically cleanup(after certain time or other dependency). Also, you > can add an identity into the Cache "key" when storeing per-user specific > data into it, the identity could be sessionID or username .... > > Anyway, no matter we use sessionstate or Cache, it is recommended that we > manually clean the data as soon as we've finished using it since they'll > consume lots of server memory(especially when storing > datatable/dataset....). > > If there is anything else you wonder, please feel free to let me know. > > Sincerely, > > Steven Cheng > > Microsoft MSDN Online Support Lead > > > This posting is provided "AS IS" with no warranties, and confers no rights. > > Not problem Chris!
Feel free to let me know if you've got any progress or need any further assistance. good luck! Sincerely, Steven Cheng Microsoft MSDN Online Support Lead This posting is provided "AS IS" with no warranties, and confers no rights.
fill ObjectDatasource on request
apply an ItemTemplate dinamically Getting row index by Event Args... Shuffling rows in a GridView DetailsView Issue. Data diagrams - like the ones in office (excel, word, et al.) Programmatically enabling Validation Controls UserControl with databound repeater drops values on postback AddWithValue NOT working UltraWebTree dragdrop event |
|||||||||||||||||||||||