473,412 Members | 1,973 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,412 software developers and data experts.

How to initiate a postback in a function?

cin
I would like to initiate a postback after I have finish executing some codes
in a dynamically created button_click event. Do anyone know? Please help!!!
Thanks

Nov 24 '05 #1
2 5149
<script language=javascript>
function hello(){ <%=
Page.ClientScript.GetPostBackEventReference(Me.cmd Hello, "")%> }
</script>
"cin" <ci*@discussions.microsoft.com> schreef in bericht
news:AB**********************************@microsof t.com...
I would like to initiate a postback after I have finish executing some
codes
in a dynamically created button_click event. Do anyone know? Please
help!!!
Thanks

Nov 24 '05 #2
Hi Edwin,

do something like you posted above:

<script runat="server">
protected override void OnLoad(EventArgs e)
{
string script = "function CustomPostback(){ " +
Page.ClientScript.GetPostBackEventReference(this, null) + "
}";
Page.ClientScript.RegisterClientScriptBlock(
GetType(), "MyScript", script, true);
base.OnLoad(e);
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" onclick="CustomPostback();" />
</div>
</form>
</body>
</html>

This is ASP.NET 2.0 code, in ASP.NET 1.1, the methods can be found on
the Page class, e.g. Page.RegisterClientScriptBlock.

Grtz, Wouter
Trainer - Info Support - www.infosupport.com
www.dive-in-it.nl

Nov 24 '05 #3

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

Similar topics

10
by: Krista Lemieux | last post by:
I'm new to ASP.NET and I'm not use to the way things are handled with this technology. I've been told that when I have a control, I should only bind the data to it once, and not on each post back...
1
by: Jordan | last post by:
I'm trying to initiate Postback from client-side script, and here's what I have that doesn't work: I have an <asp:Button> on the same page named btnSave that the user can click (its functionality...
17
by: Zvi Danovich | last post by:
Hi, I am a newby in ASP.NET, and till now wrote only simple "classic" WEB-sites. But - the time came, and now I need that: 1. Server will "listen" for some events on its local machine 2....
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
4
by: DEWright_CA | last post by:
I need to be able to from C# launch a postback. I have a command button that launches a function, I also have a javascript function that then keeps you from firing any other objects on the page,...
0
by: Jeff Jarrell | last post by:
I want to know how to initiate a postback with parameters from an anchor tag. There are many anchor tags and they are dynamic. I see some sites with the postback coming through some javascript...
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
0
by: sonic | last post by:
I am working with a 3rd party control that does not follow the asp.net event model. I would like to make it post to current page, and fire a server side event. I would like to mimic the behavior...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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,...
0
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...

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.