G
Guest
Hey,
Problems.
I have an asp form with an textbox and a button.
When I click the button I want to check te content of the textbox.
private void NextButton_Click(object sender, System.EventArgs e)
{
this.CheckInteger(TextBox1.text);
........
}
private void CheckInteger(string itext)
{
int i = 0;
try { Int32.Parse(itext); }
catch
{
const string script =
"<script language=\"javascript\">" +
"alert('Not an integer');" +
// "if(confirm('Geen integer')){}else{return false};" +
"</script>";
Page.RegisterStartupScript("CheckInt",Regex.Unescape(string.Format(script)));
}
I thought that an alert will be shown on screen, but nothing happens. Why?
Struggeling with these things. I just want to check some input and show a dialogbox to the user.
I also tried :
this.NextButton.Attributes.Add("onclick","window.showModalDialog('ZoekDossierOhra.aspx',null,'status:no;dialogWidth:370px;dialogHeight:220px;dialogHide=true;help:no;scroll:no');");
But I only want too show this dialogbox not in all circumstances, just when lets say the input is not an integer.
Thanks in advance,
Nic
Problems.
I have an asp form with an textbox and a button.
When I click the button I want to check te content of the textbox.
private void NextButton_Click(object sender, System.EventArgs e)
{
this.CheckInteger(TextBox1.text);
........
}
private void CheckInteger(string itext)
{
int i = 0;
try { Int32.Parse(itext); }
catch
{
const string script =
"<script language=\"javascript\">" +
"alert('Not an integer');" +
// "if(confirm('Geen integer')){}else{return false};" +
"</script>";
Page.RegisterStartupScript("CheckInt",Regex.Unescape(string.Format(script)));
}
I thought that an alert will be shown on screen, but nothing happens. Why?
Struggeling with these things. I just want to check some input and show a dialogbox to the user.
I also tried :
this.NextButton.Attributes.Add("onclick","window.showModalDialog('ZoekDossierOhra.aspx',null,'status:no;dialogWidth:370px;dialogHeight:220px;dialogHide=true;help:no;scroll:no');");
But I only want too show this dialogbox not in all circumstances, just when lets say the input is not an integer.
Thanks in advance,
Nic