Monday, March 26, 2012

UpdatePanel & LinkButton

Hello

I have modal dialog (window.showModalDialog) with UpdatePanel & Link button in it.

Dialog dows not allow postback.

When I use Button control i can update UpdatePanel without probkecms.

When I use LinkButton i have postback and cant get async results (new window opens with error).

Haw can i use LinkButton to update content without this problem.

Thanks

Are you using AsyncPostBackTriggers?

basic outline:

<UpdatePanel id="up1" runat="server"> <ContentTemplate> </ContentTemplate> <Triggers><!-- Place triggers here so it knows which controls trigger async postback--> <AsyncPostBackTrigger ControlID="MyControlID" /> </Triggers></UpdatePanel>

I register linkButton withRegisterAsyncPostBackControlMethod.

All works ok in common window. But in modal dialogs it invoke __doPostaBack, whitch is not allowad in dialogs.

May be It because Button have click event, but LinkButton is <a> and has href?


Could you share some code that reproduces the problem?


UpdatePanel updatePanel =newUpdatePanel();

updatePanel.UpdateMode =

UpdatePanelUpdateMode.Conditional;this.Controls.Add(updatePanel);LinkButton m_SeachLinkButton = new LinkButton ();

m_SeachLinkButton.Click += new EventHandler(FormUpdater_Event)

cell.Controls.Add(m_SeachLinkButton);

this.RegisterAsyncPostBackControl(m_SeachLinkButton.LinkButton);


This code isn't enough to reproduce the problem. It raises a lot of questions... I assume this snippet is running in a method of your page (hence "this.Controls.Add(updatePanel)". But you also do "this.RegisterAsyncPostBackControl()", yet that method is on ScriptManager. You also add the LinkButton to something called "cell", but you don't show any code for that.

I need to be able to run your code so I can see what's happening... could you please provide the entire source for a page that shows this bug?

No comments:

Post a Comment