Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Javascript Question

Reply
Thread Tools

Javascript Question

 
 
Joey
Guest
Posts: n/a
 
      05-01-2006
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?

 
Reply With Quote
 
 
 
 
bruce barker \(sqlwork.com\)
Guest
Posts: n/a
 
      05-01-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about question mark in JavaScript Jimolo Javascript 2 01-20-2008 05:02 PM
Generated JavaScript vs. Manually Created JavaScript: Which one comes first? Nathan Sokalski ASP .Net 4 11-08-2007 07:24 AM
JavaScript or not JavaScript Mark Rae ASP .Net 36 09-09-2006 01:12 PM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
Javascript -> Applet: variable reset after method call from javascript?! mcdeveloper Java 1 06-13-2006 08:34 AM



Advertisments