473,473 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Javascript from Datagrid won't fire

I have a datagrid with a linkbutton for editing. I'm trying to run some
javascript when the link button is clicked to show a wait message. Everything
works fine the first time after the page loads but on subsequent postbacks,
the script does not run.

The following code is inlcuded in the the ItemDatabound sub in the code
behind.

dim l as linkbutton
if e.item.itemType = ListItemType or e.Item.ItemType = AlternatingItem then

l = ctype(e.item.Cells(0).FindControl(lnkbutEdit"), LinkButton)
l.attributes.Add("onclick", "return busyBox.Show();")

end if

Thanks
Nov 21 '05 #1
7 1060
Mardy,

When are you adding the script to the page? Or does it exist in a .js file?

It may be that the script isn't being output on postbacks.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
I have a datagrid with a linkbutton for editing. I'm trying to run some
javascript when the link button is clicked to show a wait message.
Everything
works fine the first time after the page loads but on subsequent
postbacks,
the script does not run.

The following code is inlcuded in the the ItemDatabound sub in the code
behind.

dim l as linkbutton
if e.item.itemType = ListItemType or e.Item.ItemType = AlternatingItem
then

l = ctype(e.item.Cells(0).FindControl(lnkbutEdit"), LinkButton)
l.attributes.Add("onclick", "return busyBox.Show();")

end if

Thanks

Nov 21 '05 #2
The script is referenced from a .js file.

"S. Justin Gengo" wrote:
Mardy,

When are you adding the script to the page? Or does it exist in a .js file?

It may be that the script isn't being output on postbacks.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
I have a datagrid with a linkbutton for editing. I'm trying to run some
javascript when the link button is clicked to show a wait message.
Everything
works fine the first time after the page loads but on subsequent
postbacks,
the script does not run.

The following code is inlcuded in the the ItemDatabound sub in the code
behind.

dim l as linkbutton
if e.item.itemType = ListItemType or e.Item.ItemType = AlternatingItem
then

l = ctype(e.item.Cells(0).FindControl(lnkbutEdit"), LinkButton)
l.attributes.Add("onclick", "return busyBox.Show();")

end if

Thanks


Nov 21 '05 #3
Mardy,

Is there any difference between the html output the first time as compared
to after a postback? If there is a difference could you show the html that
is being output?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
The script is referenced from a .js file.

"S. Justin Gengo" wrote:
Mardy,

When are you adding the script to the page? Or does it exist in a .js
file?

It may be that the script isn't being output on postbacks.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
>I have a datagrid with a linkbutton for editing. I'm trying to run some
> javascript when the link button is clicked to show a wait message.
> Everything
> works fine the first time after the page loads but on subsequent
> postbacks,
> the script does not run.
>
> The following code is inlcuded in the the ItemDatabound sub in the code
> behind.
>
> dim l as linkbutton
> if e.item.itemType = ListItemType or e.Item.ItemType = AlternatingItem
> then
>
> l = ctype(e.item.Cells(0).FindControl(lnkbutEdit"), LinkButton)
> l.attributes.Add("onclick", "return busyBox.Show();")
>
> end if
>
> Thanks


Nov 23 '05 #4
Justin

No difference in the html

Thanks for your help

Mardy

"S. Justin Gengo" wrote:
Mardy,

Is there any difference between the html output the first time as compared
to after a postback? If there is a difference could you show the html that
is being output?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
The script is referenced from a .js file.

"S. Justin Gengo" wrote:
Mardy,

When are you adding the script to the page? Or does it exist in a .js
file?

It may be that the script isn't being output on postbacks.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
>I have a datagrid with a linkbutton for editing. I'm trying to run some
> javascript when the link button is clicked to show a wait message.
> Everything
> works fine the first time after the page loads but on subsequent
> postbacks,
> the script does not run.
>
> The following code is inlcuded in the the ItemDatabound sub in the code
> behind.
>
> dim l as linkbutton
> if e.item.itemType = ListItemType or e.Item.ItemType = AlternatingItem
> then
>
> l = ctype(e.item.Cells(0).FindControl(lnkbutEdit"), LinkButton)
> l.attributes.Add("onclick", "return busyBox.Show();")
>
> end if
>
> Thanks


Nov 23 '05 #5
Arghhh

I found the problem. I am using a component for scrolling the datagrid. I
took it out to test an alternative scrolling mechanism and that solved my
javascript problem.

Thanks Justin

"S. Justin Gengo" wrote:
Mardy,

Is there any difference between the html output the first time as compared
to after a postback? If there is a difference could you show the html that
is being output?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
The script is referenced from a .js file.

"S. Justin Gengo" wrote:
Mardy,

When are you adding the script to the page? Or does it exist in a .js
file?

It may be that the script isn't being output on postbacks.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
>I have a datagrid with a linkbutton for editing. I'm trying to run some
> javascript when the link button is clicked to show a wait message.
> Everything
> works fine the first time after the page loads but on subsequent
> postbacks,
> the script does not run.
>
> The following code is inlcuded in the the ItemDatabound sub in the code
> behind.
>
> dim l as linkbutton
> if e.item.itemType = ListItemType or e.Item.ItemType = AlternatingItem
> then
>
> l = ctype(e.item.Cells(0).FindControl(lnkbutEdit"), LinkButton)
> l.attributes.Add("onclick", "return busyBox.Show();")
>
> end if
>
> Thanks


Nov 23 '05 #6
Mardy have you got that working?

"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
The script is referenced from a .js file.

"S. Justin Gengo" wrote:
Mardy,

When are you adding the script to the page? Or does it exist in a .js file?
It may be that the script isn't being output on postbacks.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
I have a datagrid with a linkbutton for editing. I'm trying to run some
javascript when the link button is clicked to show a wait message.
Everything
works fine the first time after the page loads but on subsequent
postbacks,
the script does not run.

The following code is inlcuded in the the ItemDatabound sub in the code behind.

dim l as linkbutton
if e.item.itemType = ListItemType or e.Item.ItemType = AlternatingItem
then

l = ctype(e.item.Cells(0).FindControl(lnkbutEdit"), LinkButton)
l.attributes.Add("onclick", "return busyBox.Show();")

end if

Thanks


Nov 24 '05 #7
Yes Patrick

I had a control on the page that was apparently interferring with my script.

Thanks

"Patrick.O.Ige" wrote:
Mardy have you got that working?

"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
The script is referenced from a .js file.

"S. Justin Gengo" wrote:
Mardy,

When are you adding the script to the page? Or does it exist in a .js file?
It may be that the script isn't being output on postbacks.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mardy" <Ma***@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.com...
>I have a datagrid with a linkbutton for editing. I'm trying to run some
> javascript when the link button is clicked to show a wait message.
> Everything
> works fine the first time after the page loads but on subsequent
> postbacks,
> the script does not run.
>
> The following code is inlcuded in the the ItemDatabound sub in the code > behind.
>
> dim l as linkbutton
> if e.item.itemType = ListItemType or e.Item.ItemType = AlternatingItem
> then
>
> l = ctype(e.item.Cells(0).FindControl(lnkbutEdit"), LinkButton)
> l.attributes.Add("onclick", "return busyBox.Show();")
>
> end if
>
> Thanks


Nov 25 '05 #8

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

Similar topics

6
by: Jon | last post by:
Hello, I have a datagrid and the data in it is dynamically created at runtime... For iCounter = 0 To dataset.Tables(0).Columns.Count - 1 Dim objbc As New BoundColumn() With objbc .DataField...
2
by: Stephan Steiner | last post by:
Hi I'm using several DataTables in my program which are updated periodically. At the same I have those tables bound to DataGrids in my GUI. So far I've been doing all the processing in the same...
3
by: bardo | last post by:
I have a Datagrid that is inside a panel. I want to use the keyDown event to reconize the arrow keys. But I have no luck at all. The problem is that the keydown event won't fire at all, unless I...
7
by: Scott Schluer | last post by:
Hi All, I have a functioning datagrid on "Page 1" that displays order information for a single order (this is for an e-commerce site). It's actually a combination of a couple datagrids to...
2
by: Bruce W.1 | last post by:
There's something I can't figure out. I added some javascript behavior to my datagrid, just like in this article, except in C# instead of VB: ...
2
by: mark | last post by:
im having issues in creating a javascript confirm option on pressing a delete button in a datagrid - ive tried a few things but nothing seems to work (either crashes or does nothing) my codebehind...
7
by: vinay | last post by:
I have created a Master-Detail DataGrid The detail grid is embedded inside the Mastergrid with each row. Adding the detail grid in ItemDatabound event. I am exporting the Grid to a Excel....
15
by: H00ner | last post by:
Hello All Hope you can help Been pulling my hair out about a popup problem in ASP.NET. One of the forms i wrote requires the user to select a product from a list in a popup web form. the...
1
by: Ryan Liu | last post by:
Hi, I need the MouseDown event be trigged everytime when you press mouse in a datagrid (System.Windows.Forms). Hi, I need the MouseDown event be trigged everytime when press mouse in a...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.