M
Marius Horak
Hi,
When a button is pressed the user is prompted to confirm if the data should
be either deleted or archived.
Next in code-behind the application will do some data processing and after
that depending on the user answer different procedures will be called.
I can show dailog box but I'm not able to get the JavaScript return value to
my C# code..
This is what I have (the value of DA is always empty string):
protected System.Web.UI.HtmlControls.HtmlInputHidden YN;
private void Page_Load(object sender, System.EventArgs e)
{
string js = "javascript:"+
"if (confirm('Delete data ?')) document.Form1.DA.Value = 'D'; else
document.Form1.DA.Value = 'A';";
Button.Attributes.Add("onclick",js);
}
private void Button_Click(object sender, System.EventArgs e)
{
HtmlInputHidden da = (HtmlInputHidden)this.FindControl("DA");
if (da.Value == "D")
DeleteDate();
if (da.Value == "A")
ArchiveData();
}
I search the net but did not find anything else apart from using a hiddent
control. But it does not work for me.
How can I get this return value?
Thanks
MH
PS. My boss wants dialog box, not a check box or drop down list or another
form.
When a button is pressed the user is prompted to confirm if the data should
be either deleted or archived.
Next in code-behind the application will do some data processing and after
that depending on the user answer different procedures will be called.
I can show dailog box but I'm not able to get the JavaScript return value to
my C# code..
This is what I have (the value of DA is always empty string):
protected System.Web.UI.HtmlControls.HtmlInputHidden YN;
private void Page_Load(object sender, System.EventArgs e)
{
string js = "javascript:"+
"if (confirm('Delete data ?')) document.Form1.DA.Value = 'D'; else
document.Form1.DA.Value = 'A';";
Button.Attributes.Add("onclick",js);
}
private void Button_Click(object sender, System.EventArgs e)
{
HtmlInputHidden da = (HtmlInputHidden)this.FindControl("DA");
if (da.Value == "D")
DeleteDate();
if (da.Value == "A")
ArchiveData();
}
I search the net but did not find anything else apart from using a hiddent
control. But it does not work for me.
How can I get this return value?
Thanks
MH
PS. My boss wants dialog box, not a check box or drop down list or another
form.