473,762 Members | 6,675 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

effecting postback without auto postback controls

Hi, I'm wondering how I can generate a postback using javascript on a page
that does not have any controls with the auto-postback property set to true.
I know I can just use the submit() function but this triggers page
validation which I do not want. What I'm trying to do is dynamically write
in a hyperlink that when clicked will remove an item from the form, so I
don't want any validation to occur because the form isn't being submitted at
that point. And because there are no auto-postback controls the server does
not write in the javascript which would be used to effect the postback so I
can't just insert "onclick("__doP ostBack('',''); ")". Is there an easy way to
do this without manually inserting a bunch of javascript code? More
concisely... How do I manually effect a postback without triggering page
validation?

Thanks!
Richard
Nov 19 '05 #1
5 2609
Although there is a way to do postback without manually inserting all the
javascript, why not just use a linkbutton (hence all javascript is written
for you) and simply set it's CausesValidatio n to false?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Psych971" <de*********@ho tmail.com> wrote in message
news:_f******** ********@newsre ad3.news.pas.ea rthlink.net...
Hi, I'm wondering how I can generate a postback using javascript on a page
that does not have any controls with the auto-postback property set to true. I know I can just use the submit() function but this triggers page
validation which I do not want. What I'm trying to do is dynamically write
in a hyperlink that when clicked will remove an item from the form, so I
don't want any validation to occur because the form isn't being submitted at that point. And because there are no auto-postback controls the server does not write in the javascript which would be used to effect the postback so I can't just insert "onclick("__doP ostBack('',''); ")". Is there an easy way to do this without manually inserting a bunch of javascript code? More
concisely... How do I manually effect a postback without triggering page
validation?

Thanks!
Richard

Nov 19 '05 #2
Because I'm writing dynamically into the response file i don't think you can
insert asp controls, can you?

thanks,
richard

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:Ol******** ******@TK2MSFTN GP15.phx.gbl...
Although there is a way to do postback without manually inserting all the
javascript, why not just use a linkbutton (hence all javascript is written
for you) and simply set it's CausesValidatio n to false?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Psych971" <de*********@ho tmail.com> wrote in message
news:_f******** ********@newsre ad3.news.pas.ea rthlink.net...
Hi, I'm wondering how I can generate a postback using javascript on a
page
that does not have any controls with the auto-postback property set to

true.
I know I can just use the submit() function but this triggers page
validation which I do not want. What I'm trying to do is dynamically
write
in a hyperlink that when clicked will remove an item from the form, so I
don't want any validation to occur because the form isn't being submitted

at
that point. And because there are no auto-postback controls the server

does
not write in the javascript which would be used to effect the postback so

I
can't just insert "onclick("__doP ostBack('',''); ")". Is there an easy way

to
do this without manually inserting a bunch of javascript code? More
concisely... How do I manually effect a postback without triggering page
validation?

Thanks!
Richard


Nov 19 '05 #3
Are you dynamically creating it via

LinkButton lb = new LinkButton()
someControl.Con trols.Add(lb);

or are you actually writing it to the html/aspx file via a streamwriter or
something? If it's the first one, don't see why you can't add
causesValidatat ion = false...if its the second case (god why?) then you are
in trouble...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Psych971" <de*********@ho tmail.com> wrote in message
news:0Q******** ********@newsre ad1.news.pas.ea rthlink.net...
Because I'm writing dynamically into the response file i don't think you can insert asp controls, can you?

thanks,
richard

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:Ol******** ******@TK2MSFTN GP15.phx.gbl...
Although there is a way to do postback without manually inserting all the javascript, why not just use a linkbutton (hence all javascript is written for you) and simply set it's CausesValidatio n to false?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Psych971" <de*********@ho tmail.com> wrote in message
news:_f******** ********@newsre ad3.news.pas.ea rthlink.net...
Hi, I'm wondering how I can generate a postback using javascript on a
page
that does not have any controls with the auto-postback property set to

true.
I know I can just use the submit() function but this triggers page
validation which I do not want. What I'm trying to do is dynamically
write
in a hyperlink that when clicked will remove an item from the form, so I don't want any validation to occur because the form isn't being submitted
at
that point. And because there are no auto-postback controls the server

does
not write in the javascript which would be used to effect the postback
so I
can't just insert "onclick("__doP ostBack('',''); ")". Is there an easy
way to
do this without manually inserting a bunch of javascript code? More
concisely... How do I manually effect a postback without triggering

page validation?

Thanks!
Richard



Nov 19 '05 #4
You've shown me the light! I was doing it the second way but it my first
..net page so what'd you expect? :) Will switch to LinkButton.. thanks so
much! ASP.NET rules!!

peace out,
richard

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:Op******** ******@TK2MSFTN GP15.phx.gbl...
Are you dynamically creating it via

LinkButton lb = new LinkButton()
someControl.Con trols.Add(lb);

or are you actually writing it to the html/aspx file via a streamwriter or
something? If it's the first one, don't see why you can't add
causesValidatat ion = false...if its the second case (god why?) then you
are
in trouble...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Psych971" <de*********@ho tmail.com> wrote in message
news:0Q******** ********@newsre ad1.news.pas.ea rthlink.net...
Because I'm writing dynamically into the response file i don't think you

can
insert asp controls, can you?

thanks,
richard

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:Ol******** ******@TK2MSFTN GP15.phx.gbl...
> Although there is a way to do postback without manually inserting all the > javascript, why not just use a linkbutton (hence all javascript is written > for you) and simply set it's CausesValidatio n to false?
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Psych971" <de*********@ho tmail.com> wrote in message
> news:_f******** ********@newsre ad3.news.pas.ea rthlink.net...
>> Hi, I'm wondering how I can generate a postback using javascript on a
>> page
>> that does not have any controls with the auto-postback property set to
> true.
>> I know I can just use the submit() function but this triggers page
>> validation which I do not want. What I'm trying to do is dynamically
>> write
>> in a hyperlink that when clicked will remove an item from the form, so I >> don't want any validation to occur because the form isn't being submitted > at
>> that point. And because there are no auto-postback controls the server
> does
>> not write in the javascript which would be used to effect the postback so > I
>> can't just insert "onclick("__doP ostBack('',''); ")". Is there an easy way > to
>> do this without manually inserting a bunch of javascript code? More
>> concisely... How do I manually effect a postback without triggering page >> validation?
>>
>> Thanks!
>> Richard
>>
>>
>
>



Nov 19 '05 #5
I just wrote a control to do this. basically it registers a javascript
function doPostBack(arg) , that client code can call. I added a standard
server event handling, so the client can call a know routine.

string script = "<script language=\"Java Script\">functi on
doPostBack(a,v, fn){__doPostBac k('"
+ this.UniqueID + "',a,v,fn); }</script>\n";
if(!this.Page.I sClientScriptBl ockRegistered(" doPostBack"))
this.Page.Regis terClientScript Block("doPostBa ck",script);
Page.GetPostBac kEventReference (this);

the trick is, Page.GetPostBac kEventReference (this), this call is what
triggers .net generating the autopostback code.

-- bruce (sqlwork.com)
"Psych971" <de*********@ho tmail.com> wrote in message
news:_f******** ********@newsre ad3.news.pas.ea rthlink.net...
| Hi, I'm wondering how I can generate a postback using javascript on a page
| that does not have any controls with the auto-postback property set to
true.
| I know I can just use the submit() function but this triggers page
| validation which I do not want. What I'm trying to do is dynamically write
| in a hyperlink that when clicked will remove an item from the form, so I
| don't want any validation to occur because the form isn't being submitted
at
| that point. And because there are no auto-postback controls the server
does
| not write in the javascript which would be used to effect the postback so
I
| can't just insert "onclick("__doP ostBack('',''); ")". Is there an easy way
to
| do this without manually inserting a bunch of javascript code? More
| concisely... How do I manually effect a postback without triggering page
| validation?
|
| Thanks!
| Richard
|
|
Nov 19 '05 #6

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

Similar topics

1
3162
by: francois | last post by:
I have a ASPX form with a dropdownlist that makes a post back (to the same page of course, just a normal asp.net postback) That page also has an auto refresh javascript as it needs to refresh its data automatically. The problem is that when i click on the dropdownlist, i post back information to the page, then after that the next refresh will brin me a alert message populated by internet explorer saying: "The page cannot be refreshd...
10
4513
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 (basically have the data binding done in the If NOT IsPostBack Then statement). How come? How does this information get preserved? Which raises another question. Becuase I want to get away from the spaghetti code approach, I would like to create...
2
4354
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 displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event raised in the 'Handle Postback Events' stage of the control execution life cycle (via the...
0
1105
by: Antoine | last post by:
Forgive me as a beginner in asp.net. I wanted to ask some simple but clear questions, at least I hope they are. Ive seen a control in asp.net that works with codebehind and the good thing about the control it uses, is that it doesnt appear to use postback. I've generated myown app, it works well but with postback. I've tried it so that each button click only brings a ranged source of binded data, but its surely not as quite a preloading...
0
1992
by: Achim Domma (SyynX Solutions GmbH) | last post by:
Hi, in my application I suddenly get the error: "An error has occurred because a control with auto-generated id 'main:institutionManagement:institutionOverview' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events." The exception is thrown in Page.ProcessPostData. I fully understand the
2
565
by: Larry | last post by:
Is there a way to disable all the controls the instant any auto-postback controls are changed (resulting in a postback that takes a couple seconds), so that the user can't continue changing other controls while the postback to the server is running? The reason this is necessary is because the user can be fooled into not knowing that the browser has posted-back to the server (he doesn't see the little blue progress bar at the bottom of...
0
1082
by: keithb | last post by:
I posted this question earlier with an unclear predicate. Let me give it another shot: I have found that unless I re-create dynamically added controls on every postback, I am unable to access them programatically. When I do re-create them on postback, I can access them programmatically; however, the controls appear on my webpage in uplate. How can I recreate the controls on postback without having them appear in duplicate? Thanks,
2
3929
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite well, so at times it is tempting just to port parts of it over mostly as-is. In fact, one MSDN article I read suggested using straight HTML wherever possible to make the app more efficient and less resource demanding. On one page there are 2...
1
11239
by: =?Utf-8?B?V2VzbGV5IERhdmlzLCBHZW5lcmFsIER5bmFtaWNz | last post by:
I'm moving from years with the datagrid to a new project, .net 2.0, using GridView controls. Per past practice, it is often a lot easier to inject controls (or special formatting) in RowDataBound (formerly ItemDataBound) than to mess with complicated templates, especially for things that are consistent across grids or columns. GridView is dumping all the nice stuff put there during a RowDataBound event. Ex: those "!" icons in outlook or...
0
9554
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9377
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9811
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7358
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.