i am trying to do something, but i havent managed yet. when somebody clicks the remove button, page will warn ,like this "are you sure" and there will be two buttons yes and no, if the user clicks the yes data will remove. how can i do this?
i am using "confirm" but cant get the value which "confirm" returns . i am using this code for now <script language=javascript> function ask() { var myvalue = window.confirm("Remove?"); if(myvalue == true) { document.getElementById("txtbox").innerText =
"tamamdır"; } } </script> changint innertext of an a textbox and then on codebehind using this . is there any other way?
In the aspx file:
<input type="hidden" id="Hidden1" name="Hidden1" runat="server">
That adds this to the CodeBehind:
Protected WithEvents Hidden1 As System.Web.UI.HtmlControls.HtmlInputHidden
Add some JavaScript:
Dim scriptString As String = "<script language=JavaScript> " + Environment.NewLine
' Store the confirm's return in the hidden control...
scriptString += "document.getElementById('" + Hidden1.ClientID + "').value = " + Environment.NewLine
scriptString += " confirm('Overwrite?');" + Environment.NewLine
' Do a new PostBack...
scriptString += GetPostBackEventReference(Hidden1, String.Empty) + ";" + Environment.NewLine
scriptString += "</script>"
sa_keles
Member
206 Points
61 Posts
about confirm()
Apr 12, 2006 10:26 PM|LINK
hi all,
i am trying to do something, but i havent managed yet. when somebody clicks the remove button, page will warn ,like this "are you sure" and there will be two buttons yes and no, if the user clicks the yes data will remove. how can i do this?
thanks eveybody :)
http://www.sadullahkeles.com/
http://gitarvideolari.com/
sa_keles
Member
206 Points
61 Posts
Re: about confirm()
Apr 13, 2006 12:37 AM|LINK
i am using "confirm" but cant get the value which "confirm" returns . i am using this code for now <script language=javascript> function ask() { var myvalue = window.confirm("Remove?"); if(myvalue == true) { document.getElementById("txtbox").innerText = "tamamdır"; } } </script> changint innertext of an a textbox and then on codebehind using this . is there any other way?
http://www.sadullahkeles.com/
http://gitarvideolari.com/
PeterBrunone
All-Star
18495 Points
3683 Posts
MVP
Re: about confirm()
Apr 13, 2006 06:00 AM|LINK
What happens when you alert(myvalue) after setting it?
MS MVP, ASP.NET
Founder, EasyListBox.com
Do the impossible, and go home early.
sa_keles
Member
206 Points
61 Posts
Re: about confirm()
Apr 13, 2006 09:32 AM|LINK
thanks for your reply PeterBrunone , i dont have much time so i will dolike i wrote , you know shortest path is the path you know :)
http://www.sadullahkeles.com/
http://gitarvideolari.com/
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: about confirm()
Apr 13, 2006 05:48 PM|LINK
In the aspx file:
<input type="hidden" id="Hidden1" name="Hidden1" runat="server">
That adds this to the CodeBehind:
Protected WithEvents Hidden1 As System.Web.UI.HtmlControls.HtmlInputHidden
Add some JavaScript:
Dim scriptString As String = "<script language=JavaScript> " + Environment.NewLine
' Store the confirm's return in the hidden control...
scriptString += "document.getElementById('" + Hidden1.ClientID + "').value = " + Environment.NewLine
scriptString += " confirm('Overwrite?');" + Environment.NewLine
' Do a new PostBack...
scriptString += GetPostBackEventReference(Hidden1, String.Empty) + ";" + Environment.NewLine
scriptString += "</script>"
RegisterStartupScript("ConfirmScript", scriptString)
Then in Page_Load:
If IsPostBack AndAlso Request("__EVENTTARGET") = "Hidden1" Then
' Response.Write("Hidden1.Value: " + Hidden1.Value)
If Hidden1.Value = "true" Then
' User answered OK
Else
' User answered Cancel
End If
End If
Hidden1.Value = String.Empty
NC...
sa_keles
Member
206 Points
61 Posts
Re: about confirm()
Apr 14, 2006 07:50 AM|LINK
http://www.sadullahkeles.com/
http://gitarvideolari.com/
ruchipunetha
Participant
765 Points
153 Posts
Re: about confirm()
Apr 28, 2006 07:03 AM|LINK
RuchiPunetha
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: about confirm()
Apr 28, 2006 12:00 PM|LINK
You'd better learn to do some of this stuff yourself, my friend.
protected System.Web.UI.HtmlControls.HtmlInputHidden Hidden1;
Add some JavaScript:
string scriptString = "<script language=JavaScript>\n";
// Store the confirm's return in the hidden control...
scriptString += "document.getElementById('" + Hidden1.ClientID + "').value =\n";
scriptString += " confirm('Overwrite?');\n";
// Do a new PostBack...
scriptString += GetPostBackEventReference(Hidden1, string.Empty) + ";\n";
scriptString += "</script>\n";
RegisterStartupScript("ConfirmScript", scriptString);
Then in Page_Load:
if ( IsPostBack && Request["__EVENTTARGET"] == "Hidden1" )
{
// Response.Write("Hidden1.Value: " + Hidden1.Value);
if ( Hidden1.Value == "true" )
{
// User answered OK
}
else
{
// User answered Cancel
}
}
Hidden1.Value = string.Empty;
NC...
ruchipunetha
Participant
765 Points
153 Posts
Re: about confirm()
May 01, 2006 02:08 AM|LINK
Thanks NC [:D]
Ya i should do it all by myself ,ok i will try all these by myself in future. ilearned many things from this forum. i m happy [<:o)]
RuchiPunetha
ReyN
Contributor
2148 Points
413 Posts
Re: about confirm()
May 01, 2006 02:28 AM|LINK
hello
i think i have some code and actual sample of using confirm [:)]
aspxtreme