asp.NetTextboxサーバーコントロール

2316 ワード

 
  

   

   


        :
       

       

        :
           
           
       

        :
       

        :            ontextchanged="TextBox3_TextChanged">
       

        :

       
       

       

                    ImageUrl="~/img/QQ 20130909140346.png" Width="72px" />
       

       

       

       

       


   

   



textChangeのイベントコードは次のとおりです.
 
  
protected void txtNum2_TextChanged(object sender, EventArgs e)
    {
        if (txtNum2.Text.Length == 0)
        {
            //Page.RegisterClientScriptBlock("","alert(' ');");
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert(' ');");
            txtNum2.Focus();
        }
        else
        {
            int result;
            bool n1 = Information.IsNumeric(txtNum2.Text.Trim());
            if (n1)
            {
                result = int.Parse(txtNum2.Text.Trim()) % 2;
                if (result == 0)
                {
                    txtSum.Text = " ";
                }
                else
                {
                    txtSum.Text = " ";
                }
            }
        }
    }
}