Solved

Add record to a database without postback

Posted on 2009-06-27
5
597 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now