Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > effecting postback without auto postback controls

Reply
Thread Tools

effecting postback without auto postback controls

 
 
Psych971
Guest
Posts: n/a
 
      12-17-2004
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("__doPostBack('','');")". 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


 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      12-17-2004
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 CausesValidation to false?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"Psych971" <(E-Mail Removed)> wrote in message
news:_fEwd.1950$(E-Mail Removed) nk.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("__doPostBack('','');")". 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
>
>



 
Reply With Quote
 
 
 
 
Psych971
Guest
Posts: n/a
 
      12-17-2004
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:(E-Mail Removed)...
> 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 CausesValidation to false?
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Psych971" <(E-Mail Removed)> wrote in message
> news:_fEwd.1950$(E-Mail Removed) nk.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("__doPostBack('','');")". 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
>>
>>

>
>



 
Reply With Quote
 
Karl Seguin
Guest
Posts: n/a
 
      12-17-2004
Are you dynamically creating it via

LinkButton lb = new LinkButton()
someControl.Controls.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
causesValidatation = false...if its the second case (god why?) then you are
in trouble...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"Psych971" <(E-Mail Removed)> wrote in message
news:0QEwd.1850$(E-Mail Removed) nk.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:(E-Mail Removed)...
> > 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 CausesValidation to false?
> >
> > Karl
> >
> > --
> > MY ASP.Net tutorials
> > http://www.openmymind.net/
> >
> >
> > "Psych971" <(E-Mail Removed)> wrote in message
> > news:_fEwd.1950$(E-Mail Removed) nk.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("__doPostBack('','');")". 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
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
Psych971
Guest
Posts: n/a
 
      12-17-2004
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:(E-Mail Removed)...
> Are you dynamically creating it via
>
> LinkButton lb = new LinkButton()
> someControl.Controls.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
> causesValidatation = false...if its the second case (god why?) then you
> are
> in trouble...
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Psych971" <(E-Mail Removed)> wrote in message
> news:0QEwd.1850$(E-Mail Removed) nk.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:(E-Mail Removed)...
>> > 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 CausesValidation to false?
>> >
>> > Karl
>> >
>> > --
>> > MY ASP.Net tutorials
>> > http://www.openmymind.net/
>> >
>> >
>> > "Psych971" <(E-Mail Removed)> wrote in message
>> > news:_fEwd.1950$(E-Mail Removed) nk.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("__doPostBack('','');")". 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
>> >>
>> >>
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      12-17-2004
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=\"JavaScript\">function
doPostBack(a,v,fn){__doPostBack('"
+ this.UniqueID + "',a,v,fn);}</script>\n";
if(!this.Page.IsClientScriptBlockRegistered("doPos tBack"))
this.Page.RegisterClientScriptBlock("doPostBack",s cript);
Page.GetPostBackEventReference(this);

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

-- bruce (sqlwork.com)


"Psych971" <(E-Mail Removed)> wrote in message
news:_fEwd.1950$(E-Mail Removed) nk.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("__doPostBack('','');")". 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
|
|


 
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
Effecting an MDI Child from another Child Kenshin1591@gmail.com C++ 4 07-02-2006 06:27 PM
GRIDVIEW: Effecting buttonfields on single gridview rows =?Utf-8?B?TWFya0F1cml0?= ASP .Net 0 05-23-2006 08:11 PM
Formatting a single line without effecting the entire table with the Text::Table module Mothra Perl Misc 10 03-11-2005 03:56 PM
Style tag not effecting links in paging from datagrid Chumley the Walrus ASP .Net 0 08-04-2004 06:47 PM
Purging Old IE From System: How To Do Without Effecting OE ? Robert11 Computer Support 5 11-02-2003 09:19 PM



Advertisments