Showing posts with label link. Show all posts
Showing posts with label link. Show all posts

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?

Saturday, March 24, 2012

UpdatePanel and dynamically loading different aspx content pages

Hello.

I have LinkA and LinkB that should link to two aspx files, LinkA.aspx and LinkB.aspx, respectively. I simply want to enable an AJAX load into an UpdatePanel depending on which LinkButton is clicked.

My expertise is in PHP and AJAX through JavaScript's HTTPRequest method. I've got it working through my JavaScript, but I'm trying to learn/migrate to ASP.NET and its AJAX capabilities. I couldn't find any tutorials on how to do this and I've been searching for days. I would think that this isn't that hard, but I'm new to ASP and I'm not sure how to program this.

Does anyone have any suggestions on how to do this? Thank you in advance for your help.

Joshua

I think you want to load a .ascx control not a .aspx page. You can put a placeholder on a .aspx page and load .ascx controls into the placeholder (you can then wrap all this in an update panel). I have some sample code here:DynamicForms