how to fetch only newly added/edited record

G

Guest

We are using .net Framework 1.1

We are having one page on which we are using this Grid component.

From this page we open a popup for adding new record as well as for editing
an existing record (For Edit we want to pass the ID of that particular row)

And when user clicks on 'SAVE' button in popup window, those changes need to
be reflected onto the parent (into the Grid). This happens by refreshing the
parent page. But in that case all the records in grid are fetched from back
end. Instead, at server side we want only the newly added/updated record to
be fetched from the database.

AJAX or non-ajax, any way is ok. Any guidance on how to achieve this?

Thanking you in advance.
 
S

Steven Cheng[MSFT]

Hi Pravin,

From your description, you have an ASP.NET 1.1 page that display some
database record through DataGrid control, and you'll use a popup page to
add new record or editing existing record. Currently, you're wondering how
to make the added or changed record info passed to the parent page so as to
update the DataGrid, correct?

According to this issue, here are some of my understanding:

First, when adding new row or editing exist row, if you want to get the
updated/inserted new values, you should get the primarykey identity of the
certain record so that you can perform query to get the updated value
later. For editing row, this should not be a problem. For new inserted
record, the DBMS engine should provide statement for retrieving new
inserted record's identity(such as the @@Identity of SQL Server) or you can
manually control the PK of table record.

Here is a former thread discussing on retrieve new inserted
value(sqlserver)'s auto generated identity:

#Retrieving Identity Values after DetailsView Insert More options
http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/brow
se_thread/thread/8a228fb82461ec04/60bc5c390c0542b2

Second, after you get the updated value, how would you like to update the
main DataGrid's displayed data? ASP.NET template databound controls
populate data(rows) through databinding. Therefore, if you want to update
DataGrid's UI, the expected ways is to redo the databinding on DataGrid to
the new datasource. Do you think this is what you want?

In addition, for AJAX, so far ASP.NET 1.1 hasn't provide sufficient
built-in support on it. Do you think postback the page to updating the
DataGrid is acceptable?

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.
 
G

Guest

Hi I am having same query as that of Pravin

But after fetching only the newly added/edited row and updating the dataset
but again if we rebind the dataset it takes considerable time to display
whole data again. So is there any way to avoid this time or rebinding of
dataset to grid and still reflect the changes?
 
G

Guest

Hi I am having same query as that of Pravin

But after fetching only the newly added/edited row and updating the dataset
again if we rebind the dataset it takes considerable time to display
whole data again. So is there any way to avoid this time or rebinding of
dataset to grid and still reflect the changes?
 
S

Steven Cheng[MSFT]

Thanks for your input Pallavi,

Actually, no matter how we get the updated row info(through server-side
code, or use client-side script to retrieve the info by ajax way), for
updating the GridView or DataGrid(template databound control), you still
have to rebind the datasource to those controls. This is limited by the
ASP.NET databound control's model. GridView/DataGrid can only populate rows
via databinding, but not add/remove row on the fly.

BTW, what's your main concern here, are you wantting to avoid postback to
server or do not want additional databinding? For avoid postback
roundtrip, you can consider using the new ASP.NET ajax based page to make
the update without postback.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thanks Steven for your reply but

My requirement is

Refreshing the page is not a problem.For binding all records to datagrid for
the first time takes time is also not a problem.

But once whole data is fetched from the database then if we do any add,edit
or delete operation with the popup then again displaying data in the grid
onto the parent page should not take much time.

I want when we load data first time after that when we perform any operation
from the popup page (It may be adding a new record or updating the existing
one)
then it won’t take much time to reflect those changes into the grid

Can customize paging could be usefule which will fetch only the required
records for the selected page from the database?

Regards
Pallavi
 
S

Steven Cheng[MSFT]

Hi Pallavi,

Yes, I do agree that using custom paging would helps some if your record
set is large. Because when using custom paging, the databinding only need
to populate items of a single pagecount rather than all the records.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thanks Steven

But I wanted to know is there any alternative way to achieve this I mean
other than using custom paging.
 
S

Steven Cheng[MSFT]

Hi Pallavi,

So far for Gridview I haven't found any other better approach since its
databinding model restricted it on populating rows on the fly.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top