Edit Index property of Grid View is used to set index of the row to edit and Bind Grid View method is called to bind Grid View with the editing row.Then Title Id of editing row is retrieved from the Grid View and passed to Bind Details View method to show Author’s detail in the Details View [sourcecode language=”csharp”] protected void Grid View1_Row Canceling Edit(object sender, Grid View Cancel Edit Event Args e) [/sourcecode] Row Canceling Edit event fires when Cancel button of a row in edit mode is clicked.Details View control is a data-bound control that renders a single record at a time. In above code execute_fill_datalist is a function created in Class1which is described below.Find Control("rb Gender"), Radio Button List) Dim ddl Status As Drop Down List = Direct Cast(Direct Cast(sender, Details View). Find Control("rb Gender"), Radio Button List) Dim ddl Status As Drop Down List = Direct Cast(Direct Cast(sender, Details View).
Registration is fast, simple and absolutely free ." Select Command="SELECT * FROM [OUP_SAPData]" Old Values Parameter Format String="original_" Conflict Detection="Compare All Values" Update Command="UPDATE [OUP_SAPData] SET [Job No] = @Job No, [GL_Acc Code] = @GL_Acc Code, [Cost Centre] = @Cost Centre, [SAPFirst Cost Order No] = @SAPFirst Cost Order No, [ISBN] = @ISBN, [SAPPONum] = @SAPPONum, [POCondition Type] = @POCondition Type WHERE [ID] = @original_ID AND [Job No] = @original_Job No AND [GL_Acc Code] = @original_GL_Acc Code AND [Cost Centre] = @original_Cost Centre AND [SAPFirst Cost Order No] = @original_SAPFirst Cost Order No AND [ISBN] = @original_ISBN AND [SAPPONum] = @original_SAPPONum AND [POCondition Type] = @original_POCondition Type"The error message or problem description maybe?
We need to write code in Data Bound And Item Updating Events of Detailsview to get the selected value in dropdownlist from database when edit or update button is pressed.
Now to pouplate value from database in selected index of dropdown and then set the new selected value in sqldatasource parameter write below mentioned code in Data Bound and Item Updating Event of Details View respectively.
Add, Update and Delete in Details View: Item Command event is used for programmatically determining which specific command button is clicked and take appropriate action.
In one of my previous article I explained how to Master-Detail form using Grid View and Details View in ASP. In this ariticle I will explain how to edit a master/detail form in ASP.