By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,312 Members | 1,730 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,312 IT Pros & Developers. It's quick & easy.

Save button and AJAX in ASP.NET 1.1

P: n/a
Hi,

I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a very
specific feature that I would like to use it for.

I have a rather long form that the users use to enter data during a phone
call with a client. Since it's long, I put six Save buttons down the length
of the form and asked the users to save often. When they click the Save
buttons, the data is saved to a central database and a text label is changed
to say "successful" or "unsuccessful."

Since this involves a postback to the server, I turned on Smart Navigation
so that the focus would stay at the same position. I didn't want the users
to have to scroll down the length of the form every time they clicked Save.

But we're having problems with Smart Navigation.

So, my question is can I use AJAX to do the Save? I just want to send the
data to the central database without a postback. The only change to the
interface would be to return a "successful" or "unsuccessful" message. Can
anyone advise me on how to do this in 1.1?

I pasted some code below. Let me know if it would help to see the code for
the SaveData function.

Thanks!
Chris

============================

Each Save button has this behind it:

Private Sub btnSave1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave1.Click
If Page.IsValid Then
lblSave1.Visible = True
If SaveData() Then
lblSave1.Text = "Successfully saved."
Else
lblSave1.Text = "An error occurred. " & Session("ErrMsg")
End If
End If
End Sub

===============================
Apr 4 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Yes, you can use AJAX to accomplish this. You will have to write quite a bit
of javascript to accomplish this task if you have a lot of fields that need
to be saved.

Depending on how well you know JavaScript, this could be a pretty big task.

--
N. Wegner

--
Nick Wegner
MCP
"C Watson" wrote:
Hi,

I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a very
specific feature that I would like to use it for.

I have a rather long form that the users use to enter data during a phone
call with a client. Since it's long, I put six Save buttons down the length
of the form and asked the users to save often. When they click the Save
buttons, the data is saved to a central database and a text label is changed
to say "successful" or "unsuccessful."

Since this involves a postback to the server, I turned on Smart Navigation
so that the focus would stay at the same position. I didn't want the users
to have to scroll down the length of the form every time they clicked Save.

But we're having problems with Smart Navigation.

So, my question is can I use AJAX to do the Save? I just want to send the
data to the central database without a postback. The only change to the
interface would be to return a "successful" or "unsuccessful" message. Can
anyone advise me on how to do this in 1.1?

I pasted some code below. Let me know if it would help to see the code for
the SaveData function.

Thanks!
Chris

============================

Each Save button has this behind it:

Private Sub btnSave1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave1.Click
If Page.IsValid Then
lblSave1.Visible = True
If SaveData() Then
lblSave1.Text = "Successfully saved."
Else
lblSave1.Text = "An error occurred. " & Session("ErrMsg")
End If
End If
End Sub

===============================

Apr 4 '06 #2

P: n/a
Thanks for the heads up.

A hotfix for the SmartNav problem is mentioned in this Microsoft article:
http://support.microsoft.com/default...en-us%3B884022

The article recommends waiting for the next Microsoft Visual Studio .NET
2003 service pack that contains the hotfix.

This page has some info about the service pack:
http://msdn.microsoft.com/vstudio/su...3/default.aspx

“A customer beta period for Visual Studio 2003 SP1 begins March 24, 2006 and
will continue through April 24, 2006.”

Do you know if this means the service pack would be available to everyone
after April 24th? Or would there be a delay? I don’t really follow service
pack releases.

Thanks.
"AviationDev" wrote:
Yes, you can use AJAX to accomplish this. You will have to write quite a bit
of javascript to accomplish this task if you have a lot of fields that need
to be saved.

Depending on how well you know JavaScript, this could be a pretty big task.

--
N. Wegner

--
Nick Wegner
MCP
"C Watson" wrote:
Hi,

I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a very
specific feature that I would like to use it for.

I have a rather long form that the users use to enter data during a phone
call with a client. Since it's long, I put six Save buttons down the length
of the form and asked the users to save often. When they click the Save
buttons, the data is saved to a central database and a text label is changed
to say "successful" or "unsuccessful."

Since this involves a postback to the server, I turned on Smart Navigation
so that the focus would stay at the same position. I didn't want the users
to have to scroll down the length of the form every time they clicked Save.

But we're having problems with Smart Navigation.

So, my question is can I use AJAX to do the Save? I just want to send the
data to the central database without a postback. The only change to the
interface would be to return a "successful" or "unsuccessful" message. Can
anyone advise me on how to do this in 1.1?

I pasted some code below. Let me know if it would help to see the code for
the SaveData function.

Thanks!
Chris

============================

Each Save button has this behind it:

Private Sub btnSave1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave1.Click
If Page.IsValid Then
lblSave1.Visible = True
If SaveData() Then
lblSave1.Text = "Successfully saved."
Else
lblSave1.Text = "An error occurred. " & Session("ErrMsg")
End If
End If
End Sub

===============================

Apr 4 '06 #3

P: n/a
My guess is it will be available shortly after April 24th as long as they
don't have any problems they need to fix that would take a long time.

--
Nick Wegner
MCP
"C Watson" wrote:
Thanks for the heads up.

A hotfix for the SmartNav problem is mentioned in this Microsoft article:
http://support.microsoft.com/default...en-us%3B884022

The article recommends waiting for the next Microsoft Visual Studio .NET
2003 service pack that contains the hotfix.

This page has some info about the service pack:
http://msdn.microsoft.com/vstudio/su...3/default.aspx

“A customer beta period for Visual Studio 2003 SP1 begins March 24, 2006 and
will continue through April 24, 2006.”

Do you know if this means the service pack would be available to everyone
after April 24th? Or would there be a delay? I don’t really follow service
pack releases.

Thanks.
"AviationDev" wrote:
Yes, you can use AJAX to accomplish this. You will have to write quite a bit
of javascript to accomplish this task if you have a lot of fields that need
to be saved.

Depending on how well you know JavaScript, this could be a pretty big task.

--
N. Wegner

--
Nick Wegner
MCP
"C Watson" wrote:
Hi,

I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a very
specific feature that I would like to use it for.

I have a rather long form that the users use to enter data during a phone
call with a client. Since it's long, I put six Save buttons down the length
of the form and asked the users to save often. When they click the Save
buttons, the data is saved to a central database and a text label is changed
to say "successful" or "unsuccessful."

Since this involves a postback to the server, I turned on Smart Navigation
so that the focus would stay at the same position. I didn't want the users
to have to scroll down the length of the form every time they clicked Save.

But we're having problems with Smart Navigation.

So, my question is can I use AJAX to do the Save? I just want to send the
data to the central database without a postback. The only change to the
interface would be to return a "successful" or "unsuccessful" message. Can
anyone advise me on how to do this in 1.1?

I pasted some code below. Let me know if it would help to see the code for
the SaveData function.

Thanks!
Chris

============================

Each Save button has this behind it:

Private Sub btnSave1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave1.Click
If Page.IsValid Then
lblSave1.Visible = True
If SaveData() Then
lblSave1.Text = "Successfully saved."
Else
lblSave1.Text = "An error occurred. " & Session("ErrMsg")
End If
End If
End Sub

===============================

Apr 4 '06 #4

P: n/a
Sorry I'm so late to the party.

But as long as you're going to allow as-you-go updates, you might as
well include what's known as the "Yellow Fade Technique" (Google it)
for the updated fields. Also, the label that reads "Successful" could
display that for, say, five seconds and then fade away. Or else toggle
to blanks or "Changed" or some other status to indicate that a Save is
needed. The toggle would happen on any keypress that makes the form
dirty.

My two cents.

Apr 21 '06 #5

P: n/a
while ajax will work, you can do a old fashioned post to a hidden frame:

create a hidden iframe on the page.

<iframe name=hiddenPost id =hiddenPost style="width:0;height:0;"></iframe>

a label(s) to update with satatus

<span id="savestatus1"></span>

then the save buttons

<asp:button id=save1 runat=server>

in the codebehind

save1.Attributes["onclick"] = "forms[0].target='hiddenPost';"

for the final save:

donesave.Attributes["onclick"] = "forms[0].target='_self';"

when the users click the save button, a post will be done using the hidden
frame, so the focus will not move. when your code behind get a postback from
save1, it should save the data and write the following javascript. (its best
that clear the response and only write the following code)

<script>
var el = window.parent.document.getElementById(savestatus1) ;
if (el) el.innerHTML = "Saved";
</script>

-- bruce (sqlwork.com)

"C Watson" <C Wa****@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.com...
Hi,

I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a
very
specific feature that I would like to use it for.

I have a rather long form that the users use to enter data during a phone
call with a client. Since it's long, I put six Save buttons down the
length
of the form and asked the users to save often. When they click the Save
buttons, the data is saved to a central database and a text label is
changed
to say "successful" or "unsuccessful."

Since this involves a postback to the server, I turned on Smart Navigation
so that the focus would stay at the same position. I didn't want the
users
to have to scroll down the length of the form every time they clicked
Save.

But we're having problems with Smart Navigation.

So, my question is can I use AJAX to do the Save? I just want to send the
data to the central database without a postback. The only change to the
interface would be to return a "successful" or "unsuccessful" message.
Can
anyone advise me on how to do this in 1.1?

I pasted some code below. Let me know if it would help to see the code
for
the SaveData function.

Thanks!
Chris

============================

Each Save button has this behind it:

Private Sub btnSave1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave1.Click
If Page.IsValid Then
lblSave1.Visible = True
If SaveData() Then
lblSave1.Text = "Successfully saved."
Else
lblSave1.Text = "An error occurred. " & Session("ErrMsg")
End If
End If
End Sub

===============================

May 22 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.