Postback of a control using JavaScript ( using __doPostBack method)

Posted: July 27, 2012 in, C#, Uncategorized
Tags: , ,
Sometimes we require to invoke postback of a control but cannot set AutoPostBack property to true. In such case we can make use of __doPostBack method of Javascript. 

I`ll Give you A Simple Example How You Can Do This..


Include these 3 tags into your .aspx page.

<input type=”hidden” name =”__EVENTTARGET” value =”” />
<input type=”hidden” name =”__EVENTARGUMENT” value =”” />
<a id=”LButton3″ href=”javascript:__doPostBack(‘Button2′,’ ‘)”>LinkButton</a>

Here we have on anchor tag we want a server side event to fire on click of this link.

Now write this javascript function . Form1 is the id of your form.

<script type=”text/javascript”>

function __doPostBack(eventTarget, eventArgument) {
document.Form1.__EVENTTARGET.value = eventTarget;
document.Form1.__EVENTARGUMENT.value = eventArgument;


Now, Lets talk about Server Side operations . You Have To Write this code in your .cs file

protected void Page_Load(object sender, EventArgs e)
if (Request.Form[“__EVENTTARGET”] == “Button2”)
//fire event
Button2_Click(this, new EventArgs());

protected void Button2_Click(object sender, EventArgs e)
Response.Write(“postback event fired”);


this will fire your Button2_Click event..

This Is Basic , Now You Can Modify This Code as You Want 🙂

Hope This Post Will Help you Somehow . . :) . Feel Free To Ask Anything You Need.

Waiting For Your Valuable Feedback.

  1. Thanks for the good writeup. It in fact was once a amusement account it. Look complicated to more added agreeable from you! However, how can we keep up a correspondence?

  2. hid h8 says:

    Thanks a bunch for sharing this with all folks you actually know what you are speaking about! Bookmarked. Please additionally consult with my site =). We could have a hyperlink alternate agreement between us

  3. click here says:

    Quality posts is the crucial to interest the users to visit the site, that’s what this web site is providing.

  4. While circulated modern Chinese coins may be the focus of some numismatists,
    it is the commemorative, precious metal, modern Chinese coins that are issued annually by the People’s Bank of China which attract the most attention from collectors and investors. So my way to rebel against authority (bookstore clerks) was to learn how to tame powerful and ornery beasts (unicorns). There is as much as you need to totally numb any painful spots leaving you comfortable and peaceful.

  5. nervous says:

    When you produce been obese for a role of the life your become
    virtually utilized to the bad comments and your in fact
    internalise them, instead of bothering in order to query them.
    After you undergo online anxiety it can try to be difficult in order to see the larger imagine,
    as youre so unlikely to become around other people you just like to
    get out of every online circumstances making your irritating
    once possible. workout can help you out soothe sentiments of
    stress and anxiety, now it will make sense discover a powerful activity can be done with no the want to leave your home.

  6. I simply couldn’t depart your web site prior to suggesting that I extremely enjoyed the usual info an individual provide on your visitors? Is gonna be again often to inspect new posts

  7. I’m guessing you will not mind me visiting and saying thanks to you for your article – it helped

  8. certainly like your web site but you need to take a look at the spelling on several of your posts.

    Several of them are rife with spelling problems and I find it very troublesome to
    tell the reality on the other hand I will definitely come back again.

  9. Hold em says:

    Right here is the right webpage for everyone who wishes to
    understand this topic. You know so much its almost hard to argue with you (not that I
    actually would want to…HaHa). You certainly
    put a new spin on a subject that has been discussed for a long time.
    Excellent stuff, just wonderful!

  10. Alina says:

    great post, very informative. I wonder why the opposite experts of this
    sector do not notice this. You should proceed your writing.
    I’m sure, you’ve a great readers’ base already!

  11. though some artists choose repeated graphite pencils, mechanical pencils render
    a cleaner line with less smudges. I also have not had
    just about any problems with the softer wax
    building up in the blades advertisement forming clogs. The motor is actually sealed, you simply cannot see it or perhaps get to
    it, and the cutting blades tend to be made of the metal alloy.
    Then is actually the duration to start off thinking about
    in return to school buying your children. Dollar retailers have cheap items and also some office provide retailers have advertising where they give separated free items to teachers.

  12. Melba says:

    The rest of his performing profession would have the share
    of hits and also misses, however he managed to turn into a Hollywood legend.
    The business is aimed at offering trusted products at the fair price with excellent customer service.

    Brick Masonry, or in simple terms bricklaying Melbourne is a process of constructing the building after individual bricks laid in the specific pattern and also connection together.

    What Exactly Is desirable is the diploma after high school and also this really is exclusively for those
    who wish in order to become apprentices. Discover how to break things up inside simple analogies, examples and
    also concepts for them.

  13. website says:

    Yes! Finally someone writes about Tayla e Arnaldo.

  14. youtube says:

    Wow that was odd. I just wrote an really long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m
    not writing all that over again. Anyhow, just wanted to say wonderful blog!

  15. says:

    Wonderful beat ! I would like to apprentice while
    you amend your website, how can i subscribe for a blog web site?

    The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided bright clear concept

  16. Web Site says:

    Hello! I understand this is somewhat off-topic
    but I had to ask. Does operating a well-established blog such as yours take a
    lot of work? I am completely new to running a blog but I do write
    in my journal everyday. I’d like to start a blog so I will be able to share my experience and views online. Please let me know if you have any ideas or tips for brand new aspiring bloggers. Appreciate it!

  17. Ralph Lauren est connu pour créationsimple, mais extrêmement sophistiqué vêtements etaccessoires.
    effectivement, ils focus plussur style quefashion. Ralph Lauren vêtements ont minimalisteconception, qui peut aide faire une personne
    apparaissent sans effort élégant. Cette maison de mode
    a une fouleà présent car outrevêtements, ils fassiez en outre offrantaccessoires, parfums,
    et un large gamme dechemiseries. la grande news est vous
    pouvez acquérirtout du Ralph Lauren éléments online.

  18. A domicile et chaque choseà mai de chic. Comme mentionné précédemment, Ralph Lauren est aussi fournissant un array dechemiseries de
    literies de chambre décors. personnes souhaitez décorer leurs maisonsavec simple et moderne créémobilier avec
    top qualité devrait aller pourla Lauren home collections.
    ils faitleurs collections accueil avec le mêmeniveau d’inspiration sophisticationqu’ils mis enleur ligne
    de vêtements.

  19. says:

    comme partie dele dernier quelques années, e cigarettes sont également vu générer tout façon dans le industrie.
    lorsqueil est seraplusque possible à shop à juste le ministère shop ou peut-être unn traditionnel shop, êtes-vous conscients ysont détaillants conçu pour
    plus taille mesdames, etcomme les hommes. toutefois, Valentinoslignes
    exsudent sensuel, vintage appel parallèlement ssa possibilitéde féminin tissus et lacets que
    besoina incarné glamour hollywoodien pour années.

  20. Jeder Basic System sollte wirklich enthalten wiein Fortschritt der Berichtmannequin und/oderCroquis.
    ÜberFührung seines Gründers Lorenz entwickelte von Salwar Kameez bis spaghetti-träger -Oberteile jackenartiges verschiedene Zutaten verwendet werden
    können da fabric, Crêpe, Jacquard, Brokat, Viskose, NaturBaumwolle,
    ideal Seide, Chiffon, beiden Meisterköche unter Denkmaks kommt
    einfach modifizierte inmehrere Farbenin die Jeder der mag und Wahlvon Meine sehr geehrten Damen genau,
    die wählen Sie sie. Lacoste bilig in advancedMode, nur etwa jeder Marken gadget Mai werddn sehr herzlich willkommen.

  21. Ideaphydyer says:

    certified electronic health records wells fargo account number check . personal affordable health insurance cheap codeine online acupuncture and integrative medicine college health related fitness components

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s