I have a customer search dialog.
The user selects a row from the grid and Literal control is updated with Javascript which should close the dialog should then close and a customer account number field on the parent page should be updated.
This all works until I put the grid inside an Updatepanel - then selecting a row does cause the Literal cojntrol to be updated.
From some testing it seems that the Updatepanel is the cause of the problem - its not letting the grid update the Literal control when it is outside the Updatepanel (And when the Literal control is inside the Updatepanel - updating it doesnt do anything)
I think I can update the Literal control using something like Page.FindControl. However, I have been told that this breaks encapsulation and that I should raise an event from the grid and have the Literal control grab it.
Is raising an event the best solution ?
Updating a Literal with script used to be a great tool for me when I was doing 1.1 development, and posting back all of the time. Setting it with script won't cause the page to execute it unless the page were reloaded.
In this example, you should be fine with removing the UpdatePanel for a dialog box scenario, as a postback will simply cause the dialog window to close.
But I want the UpdatePanel on the dialog box - the user could run a number of searches for a customer before selecting one (Dont think I mentioned that) so I dont want to keep refreshing the whole thing if I can avoid it.
No, you didn't mention that. :)
No comments:
Post a Comment