473,513 Members | 2,616 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rendered web control using IPostBackEventHandler.RaisePostBackEvent

hi,

I'm making a custom control that is rendered implementing the
IPostBackEventHandler interface, and have got it working fine for a single
submit button, but how do i pass arguments from the HTML page back to the
server, e.g. identify which button has been pressed.

At the moment i can only cause a postback by using a submit button, are
there any other ways? - i.e. can a do a manual javascript,
document.forms[0].submit() ?

Any help / pointer welcome
TIA
Sam Martin
Nov 18 '05 #1
4 3460
When you are rendering your button, what are you setting the client onclick
event to?

You should be setting the onclick to the Page.GetPostBackClientEvent method.

I usually pass it this and the args.

IE

this.Attributes["onclick"] = Page.GetPostBackClientEvent( this, "args" );

The "args" will be passed to your RaisePostBackEvent method and you could
process it then.

bill

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:Ol**************@TK2MSFTNGP09.phx.gbl...
hi,

I'm making a custom control that is rendered implementing the
IPostBackEventHandler interface, and have got it working fine for a single
submit button, but how do i pass arguments from the HTML page back to the
server, e.g. identify which button has been pressed.

At the moment i can only cause a postback by using a submit button, are
there any other ways? - i.e. can a do a manual javascript,
document.forms[0].submit() ?

Any help / pointer welcome
TIA
Sam Martin

Nov 18 '05 #2
thanks bill, i just sussed that out, but thanks - at least i know i've got
it right....but....

when i perform a callback from an HTML control thats not a submit button,
the LoadPostData() method is not called.

it's called when a submit html button submits the form, but not when called
from an onclick event (from javascript method)

do you know why that would be?

thanks again
sam

"William F. Robertson, Jr." <wfrobertson_at_kpmg_dot_com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
When you are rendering your button, what are you setting the client onclick event to?

You should be setting the onclick to the Page.GetPostBackClientEvent method.
I usually pass it this and the args.

IE

this.Attributes["onclick"] = Page.GetPostBackClientEvent( this, "args" );

The "args" will be passed to your RaisePostBackEvent method and you could
process it then.

bill

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:Ol**************@TK2MSFTNGP09.phx.gbl...
hi,

I'm making a custom control that is rendered implementing the
IPostBackEventHandler interface, and have got it working fine for a single submit button, but how do i pass arguments from the HTML page back to the server, e.g. identify which button has been pressed.

At the moment i can only cause a postback by using a submit button, are
there any other ways? - i.e. can a do a manual javascript,
document.forms[0].submit() ?

Any help / pointer welcome
TIA
Sam Martin


Nov 18 '05 #3
ok, i've sussed it.

need a call to
Page.RegisterRequiresPostBack(this);

if anyone loosks at this for future ref.

thanks anyway bill

sam

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:O%****************@TK2MSFTNGP09.phx.gbl...
thanks bill, i just sussed that out, but thanks - at least i know i've got
it right....but....

when i perform a callback from an HTML control thats not a submit button,
the LoadPostData() method is not called.

it's called when a submit html button submits the form, but not when called from an onclick event (from javascript method)

do you know why that would be?

thanks again
sam

"William F. Robertson, Jr." <wfrobertson_at_kpmg_dot_com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
When you are rendering your button, what are you setting the client

onclick
event to?

You should be setting the onclick to the Page.GetPostBackClientEvent

method.

I usually pass it this and the args.

IE

this.Attributes["onclick"] = Page.GetPostBackClientEvent( this, "args" );

The "args" will be passed to your RaisePostBackEvent method and you could process it then.

bill

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:Ol**************@TK2MSFTNGP09.phx.gbl...
hi,

I'm making a custom control that is rendered implementing the
IPostBackEventHandler interface, and have got it working fine for a

single submit button, but how do i pass arguments from the HTML page back to the server, e.g. identify which button has been pressed.

At the moment i can only cause a postback by using a submit button, are there any other ways? - i.e. can a do a manual javascript,
document.forms[0].submit() ?

Any help / pointer welcome
TIA
Sam Martin



Nov 18 '05 #4
Yes, you were right on track.

Sorry I didn't get back to you, but you didn't need help anyway. <grin>
You probably picked up on some other tidbits of knowledge looking it up!

bill

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:uM**************@TK2MSFTNGP11.phx.gbl...
ok, i've sussed it.

need a call to
Page.RegisterRequiresPostBack(this);

if anyone loosks at this for future ref.

thanks anyway bill

sam

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:O%****************@TK2MSFTNGP09.phx.gbl...
thanks bill, i just sussed that out, but thanks - at least i know i've got
it right....but....

when i perform a callback from an HTML control thats not a submit button, the LoadPostData() method is not called.

it's called when a submit html button submits the form, but not when

called
from an onclick event (from javascript method)

do you know why that would be?

thanks again
sam

"William F. Robertson, Jr." <wfrobertson_at_kpmg_dot_com> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
When you are rendering your button, what are you setting the client

onclick
event to?

You should be setting the onclick to the Page.GetPostBackClientEvent

method.

I usually pass it this and the args.

IE

this.Attributes["onclick"] = Page.GetPostBackClientEvent( this, "args" );
The "args" will be passed to your RaisePostBackEvent method and you could process it then.

bill

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:Ol**************@TK2MSFTNGP09.phx.gbl...
> hi,
>
> I'm making a custom control that is rendered implementing the
> IPostBackEventHandler interface, and have got it working fine for a

single
> submit button, but how do i pass arguments from the HTML page back
to the
> server, e.g. identify which button has been pressed.
>
> At the moment i can only cause a postback by using a submit button,

are > there any other ways? - i.e. can a do a manual javascript,
> document.forms[0].submit() ?
>
> Any help / pointer welcome
> TIA
> Sam Martin
>
>



Nov 18 '05 #5

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

Similar topics

0
4780
by: Shane O. Pinnell | last post by:
I am sure this has come up before, but I haven't been able to find an answer as of yet. That said, any help is definitely appreciated! I have a datagrid populated from a dataset. I have a TemplateColumn with a DropDownList (DDL) in the FooterItemTemplate that is populated in the Page_Load event using a Sub Routine as the DataSource of the DDL....
1
1961
by: Lamont Adams | last post by:
Hi all, I've created numerous custom controls of varying complexity, but I've been on this problem for a day and a half, and I can't figure this mystery out. I hope one of you kind folks can point out the really obvious and stupid thing I'm overlooking here. :) I have a custom control that provides a tasklist similar to what you get in...
0
1205
by: nedk | last post by:
I am getting the following error when attempting to login to a site where I am trying to use Membership. Does anyone know why I am getting this error and how to fix it. Thanks in advance. -Ned Server Error in '/testweb' Application. -------------------------------------------------------------------------------- This feature is not...
1
3447
by: Mr Newbie | last post by:
I still have a few questions here. Ive been following some examples in a Microsoft Press book on this and have produced a small calculator control which I have written most of the code for. My quandy relates to the Postback. I have rendered my buttons with OnClick="Javascript:" & Page.GetPostBackEventReference(ControID) which when...
0
2080
by: nate | last post by:
the error returned is this: Server Error in '/AnnAccRpt' Application. -------------------------------------------------------------------------------- Could not find control 'DropDownList1' in ControlParameter 'DropDownList1'. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
2
2243
by: Learner | last post by:
Hello, I have defined another textbox control in the CreateUserWizard control and this is how I am trying to get the value of it in the code behind page is below im myStep As CreateUserWizardStep = New CreateUserWizardStep Dim DealerShipIDvalue As TextBox = myStep.ContentTemplateContainer.FindControl("_txtDealerShipID") Dim dealer As...
0
1626
by: tom c | last post by:
I am going through "Walkthrough: Editing and Inserting Data in Web Pages with the DetailsView Web Server Control" found at http://msdn2.microsoft.com/en-us/library/sdba1d59.aspx I am using Access instead of SQL Server. Everything works fine until I get to the last step, where I try to insert a record. When I hit the New link it lets me...
0
1077
by: Reshma Prabhu | last post by:
Hi, I have created a custom control derived from CompositeControl class. It implements the IPostBackEventHandler interface. It consists of multiple child controls which are hyperlinks which post back data whenever clicked. I want to get a post back event in RaisePostBackEvent method of IPostBackEventHandler interface. But the control is...
3
2073
by: deneushasler | last post by:
Hello my name is Juan Jose. My problem is as follows. When I try to insert a record into a table (access) to control DetailsView Visual Web Developer 2005, when I run the page and insert a record pulse, whenever I get the following error: How could fix it?
0
7270
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7397
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7563
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7125
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5703
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5102
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3252
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.