Wednesday, March 21, 2012

trouble with PostBack in UserControl

I have a trouble with partitial postback via AJAX.

I derived from LinkButton, added some javascipt (put argument in hidden filed and get this argument on server from hiden field) to control and in Render not rendering ID (I dont need ID because I not user server side mechanism for handling control after postBack.)

Now I try work with my new Control:

I putting my derived LinkButton inside UpdatePanel on the page.
And I have not any troubles. When Click on LinkButton - AJAX send partitial PostBack to server.

But when I put my derived LinkButton inside UserControl, and this UserControl put on page inside UpdatePanel - so I have a trouble: when I click on me LinkButton, so page send full postBack to server as if I not use UpdatePanel.

But if I render ID of LinkButton to html, so it's work in page and in userContol without any trouble. (but I don't want render ID because it's many not usefull chracters.)

May be samoebody know what I can do for resolving this situation without rendering ID (it's strangely that it work without LinkButton ID on page and not work inside UserControl?

thanks

Hi psyafter,

Take a look at this link:

http://msmvps.com/blogs/luisabreu/archive/2007/02/01/getting-a-full-postback-from-within-an-updatepanel-without-using-a-postbacktrigger.aspx

Regards,


You can add an event to the usercontrol and fire it on the link button's click event... then add this new event as the trigger.


2Participant:
first post:
I know it, but I have ID in LinkButton, and just not render it to html. And its work in page, but not work inside UserControl that on the page.

second post:
I can't add new event to triger, because LinkButon is inside UserControl, the UserControls is inside UpdatePanel on the page.

may be I can add something via Page.Register... or something like it?


Hi

I think this post can help you:

Can I specify a UserControl custom event as a Trigger for update panel on Parent page? :http://forums.asp.net/p/1123812/1785025.aspx#1785025

If you need more information,please let me know.

Thanks

No comments:

Post a Comment