Link to home
Start Free TrialLog in
Avatar of AndyTripp
AndyTripp

asked on

postback events when using an ajax updatepanel within a formview control

Hi,
I have a situation where I want to use an ajax updatepanel within a formview. I am using the update panel within an ajax modalpopup control to allow a user to make a sub form selection. When the user clicks a linkbutton within the updatepanel the modal form is hidden and the value of a text box on the formview is set....
Only thing is, because of the update panel the server side code happily sets the text property of the textbox (once found using formview1.findcontrol) but the event is not processed and the actual value stays as it was.
I have been trying to use RaisePostBackEvent thinking the formview needs a postback event before the text change will be seen but this does not seem to work.
I was trying to avoid any client side script on this...
Anyone any ideas? I have attached a working dummy VS2005 ajax project to demonstrate the problem.
Thanks in advance

PS - ALL WORKS FINE IF I PUT THE FORMVIEW ITSELF WITHIN AN UPDATE PANEL AND CALL .Update on that panel. just seems a bit much...

<asp:FormView ID="FormView1" runat="server" DataSourceID="XmlDataSource1" DefaultMode="Edit">
                <EditItemTemplate>
                    id:<asp:TextBox ID="idTextBox" runat="server" Text='<%# Bind("id") %>'></asp:TextBox><br /><br />
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Click Me..</asp:LinkButton>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </EditItemTemplate>
            </asp:FormView>

Open in new window

default.aspx.txt
default.aspx.vb.txt
addresslist.xml.txt
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

>>but the event is not processed and the actual value stays as it was.
What event are you talking about here?

Bob
Avatar of AndyTripp
AndyTripp

ASKER

Hi Bob
Probably missuse of the word 'event' on my part. I set the text value during server side processing of the link's click event (the one within the update panel) but the text box visual contents does not change. When in debug you can see the successful change of the text property but this is not shown on the webpage. There is no visual change.
Having done more testing i have found that using a second updatepanel around the entire formview works quite well. But it would be nice to know how to do an update of the formview alone which is what I seem to be missing here. formview1.update() on its own did nothing!
Thanks
Is there a reason that you couldn't wrap the entire content with an UpdatePanel?  It is kind of tricky when all the controls are not included within the UpdatePanel.

Bob
Hi. yes - on the real app I have a data form that is mostly text and dropdowns but one item requires the user to select an item from a grid once they have entered some search criteria. So they click on a button and I use the modalpupup extender to show a panel that has some text boxes and a gridview on it. They perform a simple search (for their school), select an item from the list, the modelpanel is hidden and the data they have selected is pushed in to 3 text boxes on the form (2 of which are hidden).
As I said in the original post, wrapping the entire forview in a second update panel works a treat... so I suppose I need to know if I have solved the problem or have used a sledge hammer to crack a nut!
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cool.
Thanks for the confirmation I am not going mad Bob
Andy
Any time, my friend *BIG GRIN*

Bob