Suppose you display a data having 200 records in a
datagrid. Then you edit 100 records of them. Now when you
will press update button,all 100 records should be updated
in single shot rather than reading every record and
updating. How to do it?
Answers were Sorted based on User's Feedback
Answer / guest
Here, bind primary key of database to datagrid column make
it visible false.
and travel loop as
foreach(DataGridItem dataItem in DataGrid1.Items)
{
priceText = (TextBox)dataItem.FindControl
("txtBookPrice");
bookIdText = (TextBox)dataItem.FindControl("txtBookId");
Updatecode_for_perticular_row ();
}
txtBookPrice= textbox from witch u would like to update
txtBookId= test i.e. unique id comming from database
With help of unique id in for loop find perticular text in
texbox and update.
This code you will write on update button click.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / arief
First you load 20 records to DataGrid and add one
more templet field like"Chech Box" finally add one button
in your page for update operation
you write code whatever CheckBox clike get all row
id's and you can update row based on selected id's
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / pradeep
Each row is having Edit/Update/Cancel button.
In "_UpdateCommand" event, we can write a code to update
directly into the database. But it is not good practice.
For updating whole records in a single event, we need to
have hidden column for updateflag and while updating we can
store the updated data into session. By using BUTTON
control out side of datagrid, we can find only 100 records
(updated records) based on updateflag and we can update
only those records into DB.
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / masuduz zaman
By using dataSet.GetChanges(DataRowState.Modified) method we can update all 100 records at a time.
Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between table and query?
Your manager has asked you to describe what you would use application variables for. What statement best describes the use of application variables? a) Application Variables are used to keep state for each connected user. b) Application Variables are used to keep state for the web site c) Application Variables are used to keep state for the application on the server d) Application Variables are used to keep state for all applications objects in the web site.
Where web.config file is used?
Explain the path instructions in xaml?
Define a multilingual website?
Difference between ISQL and OSQL??
If i have a web page, and one web user control, where in web page contains a text box, and web user control have check box, if i place a web user control in the webpage, when i check the check box, the out put should show it is checked or not. How we can do this?
What is parse in asp.net?
What is a server cookie?
Explain how do you deploy your asp.net application?
What is the main difference between grid layout and flow layout?
Define web.config in .net?