Solved

Add record to a database without postback

Posted on 2009-06-27
5
601 Views
Last Modified: 2013-12-17
Hi,

I need a good idea how to do something like this:
I've to add new entries to a database using a web interface.
The "Add" button is outside the input fields in a footer of the page so I can't do anything in one updatepanel (customer like to have so).
So it would look like this:

Header
-----------------------------------
M | Input1
E | Input2
N | Input3
U | Input4
-----------------------------------
Add

I like to only let the main part of the side refresh after a "Add" and start again with empt fields.
My only idea how to do is to parse the input fields with javascript, submit the data and send a refresh to a updatepanel container of the input fields.

Is there any easier way how to do?

Thanks,

Andre
0
Comment
Question by:andre72
[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
5 Comments
 
LVL 15

Expert Comment

by:jinal
ID: 24727571
Hello ,

You can do that by using pure AJAX.

Try that.

0
 

Author Comment

by:andre72
ID: 24727720
Do you have a how to for me please?
0
 
LVL 18

Accepted Solution

by:
carlnorrbom earned 500 total points
ID: 24917067
Hi,

If you need to keep the add button outside the update panel you can add it as async postback trigger such as:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            Your input markup goes here.
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <asp:Button ID="btnAdd" runat="server" Text="Add" />

This way the update panel will refresh even though the add button is placed outside the update panel.

/Carl.
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Echo'd values in dropdowns 6 32
Put POST values into cookies. 14 35
setInterval() calls function twice in one interval 2 36
Build a string of emails from a gridview 2 20
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.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 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