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. Show Modal Popup Using Javascript

Show Modal Popup Using Javascript

Scheduled Pinned Locked Moved ASP.NET
javascriptsysadmintoolshelpquestion
2 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.
  • A Offline
    A Offline
    anada8886
    wrote on last edited by
    #1

    Hi all, I have to display a modal popup on the click of a link button. the link button is inside the gridview and I have to pass the Id of the dataItem bound to the selected row to the modal popup. This I had successfully achieved using codebehind. But,now I am not suppose to write any server side code for this,hence I have show the modal popup using javascript.What I have tried uptil now is, function showModalPopup(val) { document.getElementById('&lt;%=chatCommentId_hf.ClientID%&gt;').value=val; return $find('deleteBehavior').show(); } &lt;/script&gt; -------------------------------------------------------------- protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ((LinkButton)e.Row.Cells[2].FindControl("delete_lnk")).Attributes.Add("OnClick", "javascript:return showModalPopup(" + ((Label)e.Row.Cells[1].FindControl("ChatCommentId_lbl")).Text + ");"); } } </code> This is working properly but the modal popup does not wait to get the user response,it just disappears immediately.I want it to wait till the user clicks any button on the modal popup,as it happens in case of other modal popups.Any idea how can I achieve this. Please help. Thank You.</x-turndown>

    N 1 Reply Last reply
    0
    • A anada8886

      Hi all, I have to display a modal popup on the click of a link button. the link button is inside the gridview and I have to pass the Id of the dataItem bound to the selected row to the modal popup. This I had successfully achieved using codebehind. But,now I am not suppose to write any server side code for this,hence I have show the modal popup using javascript.What I have tried uptil now is, function showModalPopup(val) { document.getElementById('&lt;%=chatCommentId_hf.ClientID%&gt;').value=val; return $find('deleteBehavior').show(); } &lt;/script&gt; -------------------------------------------------------------- protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ((LinkButton)e.Row.Cells[2].FindControl("delete_lnk")).Attributes.Add("OnClick", "javascript:return showModalPopup(" + ((Label)e.Row.Cells[1].FindControl("ChatCommentId_lbl")).Text + ");"); } } </code> This is working properly but the modal popup does not wait to get the user response,it just disappears immediately.I want it to wait till the user clicks any button on the modal popup,as it happens in case of other modal popups.Any idea how can I achieve this. Please help. Thank You.</x-turndown>

      N Offline
      N Offline
      Ningomba
      wrote on last edited by
      #2

      Place the gridview inside an update panel and that should resolve the issue. Thanks

      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