Showing posts with label argument. Show all posts
Showing posts with label argument. Show all posts

Saturday, March 24, 2012

Trigger stops working after first postback

Hi,

First let me explain the basic situation. I have a page with 2 list boxes (there are more, but for the sake of argument, take 2). The Box A contains a list of items. The Box B contains the list of items chosen by the user. There is an imagebutton that when clicked, moves the selected ListItem from Box A to Box B, and there is another imagebutton that moves a selected item from Box B to Box A.

Pretty straightforward. The list boxes are in separate update panels because they each have other triggers associated with them that are not common to the other. Here is what happens, when the move button is clicked the first time, the transfer works. After that, it's as if there is no postback at all.

Here is how I have it setup:

<

atlas:UpdatePanelID="LeftColPanel"runat="server"Mode="Conditional">
<ContentTemplate>
<asp:ListBoxID="LeftCol"runat="server"Rows="10"Width="140"/>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTriggerControlID="MoveToLeftCol"EventName="Click"/>
</Triggers>

<

asp:ImageButtonID="MoveToLeftCol"runat="server"ImageUrl="pics/left.gif"OnClick="MoveToLeft"/>

and similarly for the second List Box.

What I don't understand is why it works the first time, and not after that? Any help would be appreciated.

Thanks,

i also have the same problem with a gridview
i don't know the solution yet but do you have some strange character in your listbox?
like single quote, or something else

or maybe you already found the solution :)

if yes please let me know

thanks

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