window.confirm
-
hi friends i have one gridview in which i have one delete button .i write code for confirmation to delete on row_deleting events of datagrids. But i am facing from one problem. When first time i click on button then its doesnt give any confirm message after that when i click again then it gives message. Plz help me out my code is protected void GV_userlist_RowDeleting(object sender, GridViewDeleteEventArgs e) { LinkButton bt = (LinkButton)GV_userlist.Rows[e.RowIndex].FindControl("BT_delete"); bt.Attributes.Add("OnClick", "return window.confirm('Are you sure want to remove this user?');"); } thanks
GOD HELP THOSE WHO HELP THEMSELVES
-
hi friends i have one gridview in which i have one delete button .i write code for confirmation to delete on row_deleting events of datagrids. But i am facing from one problem. When first time i click on button then its doesnt give any confirm message after that when i click again then it gives message. Plz help me out my code is protected void GV_userlist_RowDeleting(object sender, GridViewDeleteEventArgs e) { LinkButton bt = (LinkButton)GV_userlist.Rows[e.RowIndex].FindControl("BT_delete"); bt.Attributes.Add("OnClick", "return window.confirm('Are you sure want to remove this user?');"); } thanks
GOD HELP THOSE WHO HELP THEMSELVES
Hi, When the page is first rendered, the link button will not have the onclick attribute. U R adding the confirmation property after the page has been posted back. The newly rendered page will have the link button with onclick attribute set. That is why, the confirmation messaged is displayed for the second time alone. U will have to add the onclick attribute before the page is loaded for the first time. Try this: GV_userlist.Databind(); for(int i=0;i<GV_userlist.Rows.Count;i++) { LinkButton bt = (LinkButton)GV_userlist.Rows[i].FindControl("BT_delete"); bt.Attributes.Add("OnClick", "return window.confirm('Are you sure want to remove this user?');"); }
Regards, Arun Kumar.A
-
hi friends i have one gridview in which i have one delete button .i write code for confirmation to delete on row_deleting events of datagrids. But i am facing from one problem. When first time i click on button then its doesnt give any confirm message after that when i click again then it gives message. Plz help me out my code is protected void GV_userlist_RowDeleting(object sender, GridViewDeleteEventArgs e) { LinkButton bt = (LinkButton)GV_userlist.Rows[e.RowIndex].FindControl("BT_delete"); bt.Attributes.Add("OnClick", "return window.confirm('Are you sure want to remove this user?');"); } thanks
GOD HELP THOSE WHO HELP THEMSELVES
-
Hi, When the page is first rendered, the link button will not have the onclick attribute. U R adding the confirmation property after the page has been posted back. The newly rendered page will have the link button with onclick attribute set. That is why, the confirmation messaged is displayed for the second time alone. U will have to add the onclick attribute before the page is loaded for the first time. Try this: GV_userlist.Databind(); for(int i=0;i<GV_userlist.Rows.Count;i++) { LinkButton bt = (LinkButton)GV_userlist.Rows[i].FindControl("BT_delete"); bt.Attributes.Add("OnClick", "return window.confirm('Are you sure want to remove this user?');"); }
Regards, Arun Kumar.A
Call on page load even it will work properly page load() { bt.Attributes.Add("OnClick", "return window.confirm('Are you sure want to remove this user?');"); }
Sujit