|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DetailsView Issue.Hi there,
I am using a GridView and displaying details in a Detailsview control. Now then I select a Row in the Gridview the details on for that record shows on the Detailsview control, but when there is/are not related records on the detailsview, the detailsview does not show at all. the functionality that I'm looking for is when I select a Row on the Gridview, if that specific record does not have a related record or the PrimaryKey does not exist on the details table, I want the detailsview to automatically goes on Insert Mode so the user can star creating detail records for the parent record. Now, how can I tell when the detailsview control did not bring any records from the database? Thanks very much. Midway I am not sure I fully understand your question. From what you wrote I
will assume you have not bound your GridView and DetailsView to the SqlDatasource. When bind them to eachother you would normally do that so it would ensure they both have the same records. I do this with the following code: protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { DetailsView1.PageIndex = GridView1.SelectedIndex; DetailsView1.ChangeMode(DetailsViewMode.Edit); } To create a new record using the DetailsView, I have added a button to the page and attached this event handler. protected void Button1_Click(object sender, EventArgs e) { DetailsView1.PageIndex = -1; DetailsView1.ChangeMode(DetailsViewMode.Insert); } That should allow you to insert a new record which you can select from the GridView and edit in the DetailsView. Let me know if this is what you needed. Brennan Stehling http://brennan.offwhite.net/blog/ Midway wrote: Show quoteHide quote > Hi there, > > I am using a GridView and displaying details in a Detailsview control. Now > then I select a Row in the Gridview the details on for that record shows on > the Detailsview control, but when there is/are not related records on the > detailsview, the detailsview does not show at all. the functionality that I'm > looking for is when I select a Row on the Gridview, if that specific record > does not have a related record or the PrimaryKey does not exist on the > details table, I want the detailsview to automatically goes on Insert Mode so > the user can star creating detail records for the parent record. > > Now, how can I tell when the detailsview control did not bring any records > from the database? > > Thanks very much. > > Midway
Really Stuck on a Canlendar Control PLEASE HELP!!!
Javascript disabled Menu control Accessibility Events for programatically added controls UserControl values lost on PostBack I am trying to hide some textboxes, dropdownlists and labels in datalist Video Player in browser... how do I do? Data diagrams - like the ones in office (excel, word, et al.) CustomWeb Controls and Events I want to know what is a Functional Specification Document? Clikable rows in Grid View |
|||||||||||||||||||||||