Endless Loop refreshing DGrid after Updating another DGrid

  • Thread starter Thread starter Derek
  • Start date Start date
D

Derek

I am trying to refresh one datagrid after updating
another datagrid. I can not call BindData for one under
the other bind sub because it creates an endless loops on
page load. Is there way to rebind without the loop or
how could I call page.refresh or at least close the
window after one datagrid is updated. Any help? Thanks
in advance...
 
Hello Derek,

Thanks for your post. By "BindData", do you mean "DataBind"? I am not quite
sure about your scenario which will cause an infinite loop. Could you
please post some code snippet or a sample project and tell me the detailed
steps to reproduce the proble? That will be most helpful for me to pinpoint
the probelm and resolution.

I look forward to hearing from you.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
There are two datagrids on the page depending on how a row is edited it
could move from one datagrid to the other. It will only show after the
datagrid is rebound. I wanted to add rebind each datagrid in the update
command but the page will not load if I have that code active. I have a
button that when clicked rebinds each datagrid. That works but I would
like for it be seamless. Thanks in advance...



Sub binddatagrid()

mid = Request.QueryString("mission_id")

SqlSelectCommand1.Parameters("@missionid").Value = mid

SqlSelectCommand1.Parameters("@Ssn").Value = "%"

SqlDataAdapter1.Fill(DsChkCrew1)

DataGrid1.DataBind()

'bindbelowline







End Sub

Sub BindBelowline()

mid = Request.QueryString("mission_id")

SqlSelectCommand2.Parameters("@missionid").Value = mid

SqlSelectCommand2.Parameters("@Ssn").Value = "%"

SqlDataAdapter2.Fill(DsCkhCrewBL1)

DataGrid2.DataBind()

'binddatagrid



End Sub
 
Hi Derek,

Thanks for your reply. I am checking this issue and will update you with my
finding.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Derek,

I reviewed your description carefully, and now I'd like to share the
following information with you:

The simplest method to work around this problem is to add a parameter for
each function specifying whether or not it should rebind another datagrid
(or you can use a global variable). For example:

//----------------code snippet-------------
Sub binddatagrid (byval bRebind as Boolean)
......
if (bRebind)
BindBelowline (false)
End Sub

Sub BindBelowline (byval bRebind as Boolean)
......
if (bRebind)
binddatagrid (false)
End Sub
//------------------end of---------------------

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top