Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem with Update Panel [modified]

Problem with Update Panel [modified]

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptdatabasetoolshelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M_Menon
    wrote on last edited by
    #1

    Hi Friends I am using Ajax in C#.NET. I have recently noticed that. I cannot fire Messagebox(Javascript-JS) if inside Update Panel. I am using Update Panel on my GridView. Only click of Delete Button i am firing one JS asking "Are You Sure" My Code LinkButton l = (LinkButton)e.Row.FindControl("lbtnDelete"); l.Attributes.Add("onclick", "javascript:return " + "confirm('Are You Sure You want to Delete ? ')"); The Above Code works perfectly. But then i make a DataBase Check if that Record is used anywhere else. So its like if(CheckRecord) Response.Write("<script>alert('Are you sure youw want to Continue?')</script>"); It doesnt work. i tired another dll for msgbox, which also doesnt work. I suspected for the Update panel. And i was right. If i remove the Update Panel both the options fire MessageBox for me. But i am using Edit,Delete,AddNew methods in GridView henceforth i need Update Panel. Now i have no Idea what should i do? Any solutions would be appreciated. Thanks -- modified at 8:22 Friday 2nd November, 2007

    Cheers Menon

    V 1 Reply Last reply
    0
    • M M_Menon

      Hi Friends I am using Ajax in C#.NET. I have recently noticed that. I cannot fire Messagebox(Javascript-JS) if inside Update Panel. I am using Update Panel on my GridView. Only click of Delete Button i am firing one JS asking "Are You Sure" My Code LinkButton l = (LinkButton)e.Row.FindControl("lbtnDelete"); l.Attributes.Add("onclick", "javascript:return " + "confirm('Are You Sure You want to Delete ? ')"); The Above Code works perfectly. But then i make a DataBase Check if that Record is used anywhere else. So its like if(CheckRecord) Response.Write("<script>alert('Are you sure youw want to Continue?')</script>"); It doesnt work. i tired another dll for msgbox, which also doesnt work. I suspected for the Update panel. And i was right. If i remove the Update Panel both the options fire MessageBox for me. But i am using Edit,Delete,AddNew methods in GridView henceforth i need Update Panel. Now i have no Idea what should i do? Any solutions would be appreciated. Thanks -- modified at 8:22 Friday 2nd November, 2007

      Cheers Menon

      V Offline
      V Offline
      Venkatesh Mookkan
      wrote on last edited by
      #2

      Menon, You cannot use Response.Write while using Microsoft AJAX, since the page will not postbacks fo your request. You can use Client Script of the Microsoft AJAX. Add handler for endRequest like below,

      Sys.WebForms.PageRequestManager.getInstance().add_endRequest(CheckRecordCallBack);
      
      CheckRecordCallBack(sender, arg){
          if (args){
              if (args.get_error()){
                  args.set_errorHandled(true);		                
                  alert(args.get_error().message);
              }
          }		           		        		            
      }
      

      You must throw the Message which you want to show after CheckRecord process from the CodeBehind. For more reference, read http://www.asp.net/ajax/documentation/live/ClientReference/default.aspx[^]

      Regards, Venkatesh Mookkan. Software Engineer, India My: Website | Yahoo Group | Blog Spot

      M 1 Reply Last reply
      0
      • V Venkatesh Mookkan

        Menon, You cannot use Response.Write while using Microsoft AJAX, since the page will not postbacks fo your request. You can use Client Script of the Microsoft AJAX. Add handler for endRequest like below,

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(CheckRecordCallBack);
        
        CheckRecordCallBack(sender, arg){
            if (args){
                if (args.get_error()){
                    args.set_errorHandled(true);		                
                    alert(args.get_error().message);
                }
            }		           		        		            
        }
        

        You must throw the Message which you want to show after CheckRecord process from the CodeBehind. For more reference, read http://www.asp.net/ajax/documentation/live/ClientReference/default.aspx[^]

        Regards, Venkatesh Mookkan. Software Engineer, India My: Website | Yahoo Group | Blog Spot

        M Offline
        M Offline
        M_Menon
        wrote on last edited by
        #3

        Hi Venkatesh Thanks for the reply i will try it. I even found another solution for my question. ScriptManager.RegisterStartupScript This also works. Thanks

        Cheers Menon

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups