Solved

AJAX Toolkit Accordion Pane & TextBox Text

Posted on 2011-02-16
5
1,358 Views
Last Modified: 2012-05-11
I am using the AJAX Toolkit's Accordion control in a project.

In the first pane, I have an UpdatePanel.  Within that UpdatePanel is an HTML table with several TextBox Controls that receive data from a database via a class, "Profile," I have created.  The table also has a Button control which, when clicked, should update the database with the values in the TextBoxes, via the Profile class.

In the page's page_load event, I successfully target and set the values of the TextBoxes from the custom class, "Profile".

The trouble occurs when I attempt to update the database with the Button's Click event handler.  Within this event handler, I set the Profile class' properties with the values from the TextBoxes.  Strangely, the TextBox.Text properties for all of the TextBoxes return exactly the same text that was set during the Page_Load event -- NO CHANGES TO THE TEXT WITHIN THE TEXTBOXES ARE REFLECTED WHEN THE BUTTON IS CLICKED.

This is not a database issue.  I have used the debugger to step through my code and the TextBox.Text property for each of the TextBoxes has been checked.  It is the same text as originally set in the TextBoxes during the Page_Load event, and not the actual text present when the button is clicked.

Experts, any ideas as to what I'm doing incorrectly?
0
Comment
Question by:ewolsing
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 11

Expert Comment

by:SAMIR BHOGAYTA
ID: 34913514
0
 

Author Comment

by:ewolsing
ID: 34913567
samirbhogayta:

Yes, I've seen that link.  It was the page I used as reference when I initially created the Accordion control on my page.  Unless I missed it, it does not cover my issue.

For some reason, the TextBoxes within the accordion control are not registering any updated text, beyond what was initially set in the Page_Load event, when the Button's Click event is raised.
0
 

Accepted Solution

by:
ewolsing earned 0 total points
ID: 34920524
I solved the problem after much Googling.

Because the controls I was attempting to access resided in an AJAX UpdatePanel, the Page_Load event was being fired before the Button_Click event containing the code for retrieving and updating the values in the TextBoxes.  Therefore, the fields were being re-populated with the original values from the database before the SQL Update command was being issued.  That is why the fields appeared to not reflect changes made prior to the button click.

My ultimate solution was to place the code filling the TextBoxes in the Page_Load event into an IF statement checking if the page was experiencing a postback.  Hence:

Protected Sub Page_Load(Byval sender as Object, byval e as System.EventArgs) Handles Me.Load
     If Not Page.IsPostBack Then
          PopoulateFields()
     End if
End sub
0
 

Author Comment

by:ewolsing
ID: 34920568
I have answered my own question.
0
 

Author Closing Comment

by:ewolsing
ID: 34949809
I answered my own question.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 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