ajaxRequestWithTarget Argument

2 posts, 0 answers
  1. James Shelton-Agar
    James Shelton-Agar avatar
    108 posts
    Member since:
    May 2008

    Posted 21 Jul 2009 Link to this post

    hi there, I have used ajaxRequestWithTarget for a button ajax event. I wish to pass argument to the button event and how would i get it out as a string?  for example, 

     

    ajaxRequestWithTarget(

    "btnRefreshAct", "RebindTask")

    how would i get the RebindTask from the buttonclickEvent from Radajaxmanager?

     

     

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 22 Jul 2009 Link to this post

    Hi James,

    ajaxRequestWithTarget is designed as a substitute of the standard __doPostBack function. Thus, you need to override RaisePostBackEvent of the page in order to get its argument server-side.

    C#:
     
    protected void btnRefreshAct_Click(object sender, EventArgs e) 
        if(arg!= ""
        Response.Write(arg); 
    protected override void RaisePostBackEvent(IPostBackEventHandler source, String eventArgument) 
        if (source == btnRefreshAct && eventArgument == "RebindTask"
        { 
            arg = eventArgument.ToString(); 
            base.RaisePostBackEvent(source, eventArgument); 
        } 

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top