Show Modal Popup Using Javascript
-
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('<%=chatCommentId_hf.ClientID%>').value=val; return $find('deleteBehavior').show(); } </script> -------------------------------------------------------------- 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>
-
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('<%=chatCommentId_hf.ClientID%>').value=val; return $find('deleteBehavior').show(); } </script> -------------------------------------------------------------- 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>