I have a DetailsView in my page for inserting new data (wich has the "Insert" mode as default) , but it only shows up when the user clics a "new" link (outside the DetailsView). The "new" link and the "cancel" link (this one as a command field inside the DetailsView) are setting the visible property of the DetailsView using an Atlas script:
The link button is declared as follows:
<
asp:LinkButtonID="linkButtonNuevo"runat="server"CausesValidation="False"EnableViewState="False"OnClientClick="javascript:return false">Crear nuevo tipo</asp:LinkButton>(I'm usingOnClientClick="javascript:return false"to prevent a postBack)
The cancel link (inside the DetailsView command field) is set by this code in the DetailsView DataBound event handler:
link.ID =
"linkButtonCancelarNuevo";link.Attributes[
"onClick"] ="javascript:return false";The Atlas Script is:
<control id="ctl00_ContentPlaceHolder1_detailsViewNuevo" cssClass="HiddenElement" />
<hyperLink id="ctl00_ContentPlaceHolder1_linkButtonNuevo">
<click>
<setProperty target="ctl00_ContentPlaceHolder1_detailsViewNuevo" property="cssClass" value="VisibleElement" />
</click>
</hyperLink>
<hyperLink id="ctl00_ContentPlaceHolder1_detailsViewNuevo_linkButtonCancelarNuevo">
<click>
<setProperty target="ctl00_ContentPlaceHolder1_detailsViewNuevo" property="cssClass"value="HiddenElement" />
</click>
</hyperLink>
By the way... I'm using a MasterPage, and this things (the link and the DetailsView) are inside an UpdatePanel.
So, I can keep showing/hiding the detailsView perfectly as long as I want (clicking new / cancel)... However, when I click the insert button in the DetailsView to save the data, it saves the data (calling a server-side method) and makes a partial postBack. After that, the Atlas script does not work anymore!!! I click the new link, but absolutely nothing happens... In fact, this happens after a partial postback caused everywhere else in the page...
I don't know if there is something I'm missing about the script or the UpatePanel and the partial postback... so, can anyone tell me what is happening here?
Thanks for any help
AlexPhi
hello.
well, i'm assuming that you've placed the links inside the updatepanel...in that case, the xml-script will be discarded since those objects will be destroyed (ie, replaced), when the client receives the new html sent from the server. if this is your scenario, then you must introduce the xml-script during all the postbacks (i think that you might have to build an extender that adds this code to the page during all the postbacks).
No comments:
Post a Comment