Connecting Tech Pros Worldwide Forums | Help | Site Map

how to refresh screen after delete a record

J
Guest
 
Posts: n/a
#1: Nov 18 '05
Hi, all
I have a simple question but have no clue how to do this:
I have a datagrid in a web form which presents each user's info, after admin
selected a user, then click 'delete' button, that user will removed from backend
database. Now, how can I have screen refresh to display updated data?

Thanks in advance.
Karl Seguin
Guest
 
Posts: n/a
#2: Nov 18 '05

re: how to refresh screen after delete a record


When the button is clicked, and the codebehind event fires, let's call it
"MyGrid_OnItemCommand", you need to rebind your datagrid..since you didn't
give us your existing code, this will hopefully give you an idea:


sub page_load
if not Page.IsPostBack then
BindUserGrid()
end if
end sub

private sub MyGrid_OnItemCommand(s as object, e as DataGridCommandEventArg)
select e.CommandName.ToUpper()
case "DELETE"
UserUtility.DeleteUser(Convert.ToInt32(e.CommandAr gument)) 'delete
the user from the backend database
BindUserGrid(); //rebinds the grid
end select
end sub

private sub BindUserGrid()
MyGrid.DataSource = UserUtility.GetAllUsers() //gets the user
MyGrid.DataBind()
end sub


If GetAllUsers was returning a cached result, you'd need to invalidate the
cache. the best place to do this, in the above code anyways, is in the
UserUtility.DeleteUser function

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"J" <j@NoSpam.org> wrote in message
news:gvivn0pd3a6m11fg1ufh8dr4vlf1kumaut@4ax.com...[color=blue]
> Hi, all
> I have a simple question but have no clue how to do this:
> I have a datagrid in a web form which presents each user's info, after[/color]
admin[color=blue]
> selected a user, then click 'delete' button, that user will removed from[/color]
backend[color=blue]
> database. Now, how can I have screen refresh to display updated data?
>
> Thanks in advance.[/color]


WJ
Guest
 
Posts: n/a
#3: Nov 18 '05

re: how to refresh screen after delete a record


Or you can use the MS/DAAB, which is much better. It takes care of
everything for you:
http://support.microsoft.com/default...b;en-us;829028

John


Closed Thread