?
Solved

postback events when using an ajax updatepanel within a formview control

Posted on 2008-02-11
7
Medium Priority
?
2,285 Views
Last Modified: 2013-11-26
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
0
Comment
Question by:AndyTripp
  • 4
  • 3
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20867128
>>but the event is not processed and the actual value stays as it was.
What event are you talking about here?

Bob
0
 

Author Comment

by:AndyTripp
ID: 20867328
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
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20867432
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
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 

Author Comment

by:AndyTripp
ID: 20867504
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
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 375 total points
ID: 20867540
No, you haven't used an elephant gun to go squirrel hunting.  Like I said, it is darn near impossible to get a working solution, unless there is an outer UpdatePanel to wrap the entire contents.

Bob
0
 

Author Comment

by:AndyTripp
ID: 20867578
Cool.
Thanks for the confirmation I am not going mad Bob
Andy
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20867592
Any time, my friend *BIG GRIN*

Bob
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question