473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to select a specific client-side sub to run

Sue
ASP.NET web page: get info from user via web server controls, user clicks web
server button when happy with new values, code behind sub grabs the data and
updates a SQL database. At this point, I would like to display a msgbox/alert
to the user indicating success or failure of the database update. I am
familiar with registering client-side script blocks and assigning them to
buttons, etc via an attribute assignment in the itemdatabound sub. But how
can I specify which client-side script to call depending on the database
update results and how would I call it from the server side? Or is what I
would like to do not possible?

tia,
Sue
Nov 18 '05 #1
5 1278
On Wed, 17 Nov 2004 16:08:02 -0800, Sue <Su*@ojd.state.or.us> wrote:
ASP.NET web page: get info from user via web server controls, user
clicks web
server button when happy with new values, code behind sub grabs the data
and
updates a SQL database. At this point, I would like to display a
msgbox/alert
to the user indicating success or failure of the database update. I am
familiar with registering client-side script blocks and assigning them to
buttons, etc via an attribute assignment in the itemdatabound sub. But
how
can I specify which client-side script to call depending on the database
update results and how would I call it from the server side? Or is what I
would like to do not possible?

tia,
Sue


So, you want to do it as the page loads? Because you update the DB on the
server (during server postback processing)..then just register a call via
javascript to run at page load using:

http://msdn.microsoft.com/library/de...cripttopic.asp

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2
Hi Sue,

As Craig has mentioned, the Page.RegisterStartupScript can help render out
a script block. If you just need display different javascript alert
message depending on the processing result at serverside(codebehind), I
think we can make a helper function like:
public const string SCRIPT_MSGBOX = "<script
language='javascript'>alert('{0}');</script>";

private void DisplayMessageBox(string msg)
{

Page.RegisterStartupScript("msgbox_script",string. Format(SCRIPT_MSGBOX,msg))
;
}

Then, we can call the "DisplayMessagebox" with different message param
after our database update processing. How do you think?

If there is any other concerns , please feel free to post here. Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #3
Sue
Steven (and Craig), I think this is just what I'm looking for. I'll give it a
try today and let you know. Thanks! Sue

"Steven Cheng[MSFT]" wrote:
Hi Sue,

As Craig has mentioned, the Page.RegisterStartupScript can help render out
a script block. If you just need display different javascript alert
message depending on the processing result at serverside(codebehind), I
think we can make a helper function like:
public const string SCRIPT_MSGBOX = "<script
language='javascript'>alert('{0}');</script>";

private void DisplayMessageBox(string msg)
{

Page.RegisterStartupScript("msgbox_script",string. Format(SCRIPT_MSGBOX,msg))
;
}

Then, we can call the "DisplayMessagebox" with different message param
after our database update processing. How do you think?

If there is any other concerns , please feel free to post here. Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #4
Sue
Steve, this worked beautifully. Thank you!

Sue

"Steven Cheng[MSFT]" wrote:
Hi Sue,

As Craig has mentioned, the Page.RegisterStartupScript can help render out
a script block. If you just need display different javascript alert
message depending on the processing result at serverside(codebehind), I
think we can make a helper function like:
public const string SCRIPT_MSGBOX = "<script
language='javascript'>alert('{0}');</script>";

private void DisplayMessageBox(string msg)
{

Page.RegisterStartupScript("msgbox_script",string. Format(SCRIPT_MSGBOX,msg))
;
}

Then, we can call the "DisplayMessagebox" with different message param
after our database update processing. How do you think?

If there is any other concerns , please feel free to post here. Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #5
You're welcome Sue,

I'm also glad to assist you.
Have a good day!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bob Bedford | last post by:
I've a site where companies add their article. I'de like to provide a "lasts articles" table. By this, I'll show last articles inserted. But I won't always the same articles at any refresh....
1
by: Adam Balgach | last post by:
I am having a bit of a problem, and it might have to do with my understanding of how select works... basically what i am trying to simulate is a system: client->gateway->server model. The...
3
by: Marcia Hon | last post by:
Hi, I am trying to use the select() socket programming command to select between stdin and a connection. Currently, I have a listening stream and stdin that I insert into the fd_set. The problem...
0
by: Vagabond Software | last post by:
I posted this problem earlier and now have more information. I use the DataTable Select method to get find the most recent "LastModified" date in a table of similarly named files. I then use the...
1
by: Marcelo | last post by:
_____ From: Marcelo Posted At: Friday, September 30, 2005 1:40 PM Posted To: microsoft.public.dotnet.languages.vb Conversation: Subject: Client and Server - Listen por packets in a specific...
14
by: alsmeirelles | last post by:
Hi, I'm building a multithreaded application and I encountered a tiny and annoying problem. I use a select to wait for data to be read from a socket, after some reads, the select simply blocks...
16
by: Brian D | last post by:
I have a multiple select list that is created dynamically based on a previous selection on an asp page. The first thing I do is to clear the curent option list by ...
13
by: roberto | last post by:
I have this kind of information on a db table COMPANY USER MYDATA ______________________________ AA 01 AA01 USER AAUS 01 USER AA01US BB
16
by: Richard Maher | last post by:
Hi, I have this Applet-hosted Socket connection to my server and in an ONevent/function I am retrieving all these lovely rows from the server and inserting them into the Select-List. (The on...
5
by: Ronald S. Cook | last post by:
From my business tier (class) I get back an IQueryable<Penof data. Here is my client code that works fine: PenClass penClass = new PenClass(); IQueryable<Penpens = penClass.SelectPens(); ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.