473,398 Members | 2,427 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,398 software developers and data experts.

Javascript Question

I have a third party menu server control. I want to be able to plant
"__doPostBack('MyControlName',' ')" into the NavigateURL property of it
to force a postback when it is clicked. On the server side I have made
a code block named "protected void MyControlName_Click()" But when I
run the page and click on the menu item, the server side code block
does not execute. The page already has the necessary javascript
functions to do the postbacks as I have linkbuttons and other controls
on the page. I can see that I am not wiring this up properly. How
should I do it?

May 1 '06 #1
1 778
you need to subclass the third party control and implement the postback
event handling interface. something like:

public class MyControl : ThirdPartControl,IPostBackEventHandler
{
public delegate void MyEventHandler(object sender, EventArgs e);
public event MyEventHandler Click;

protected virtual void OnClick(EventArgs e)
{
if (Click != null) Click(this, e);
}
public void RaisePostBackEvent(string eventArgument)
{
// ignore data
OnClick(new PostBackerEventArgs(new EventArgs());
}
protected override void OnInit(EventArgs e)
{
// tell .net to enable client postbacks
Page.GetPostBackEventReference(this);
}
}

then register you serverside callback.

-- bruce (sqlwork.com)
"Joey" <jo*********@topscene.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
I have a third party menu server control. I want to be able to plant
"__doPostBack('MyControlName',' ')" into the NavigateURL property of it
to force a postback when it is clicked. On the server side I have made
a code block named "protected void MyControlName_Click()" But when I
run the page and click on the menu item, the server side code block
does not execute. The page already has the necessary javascript
functions to do the postbacks as I have linkbuttons and other controls
on the page. I can see that I am not wiring this up properly. How
should I do it?

May 1 '06 #2

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

Similar topics

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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.