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

Javascript from Datagrid won't fire

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.